➽ Problem:-
https://www.hackerrank.com/challenges/mini-max-sum/problem
➽ Solution:-
#include
<stdio.h>
int main()
{
int arr[5];
long
sum=0;
for(int i=0;i<5;i++)
{
scanf("%d", arr+i);
sum += arr[i];
}
int min = arr[0];
int max = arr[0];
for(int i=1;i<5;i++)
{
if(arr[i]>max)
max = arr[i];
if(arr[i]<min)
min = arr[i];
}
printf("%ld
%ld",sum-max,sum-min);
return 0;
}
0 Comments
Please do not enter any spam link in the comment section.