https://www.hackerearth.com/practice/basic-programming/implementation/basics-of-implementation/practice-problems/algorithm/find-the-pattern-6/submissions/
#include<stdio.h>
int main()
{
unsigned long long int n;
scanf("%llu",&n);
unsigned long long int temp;
scanf("%llu",&temp);
unsigned long long int max=temp, min= temp;
while(n--)
{
scanf("%llu",&temp);
if(max < temp)
max=temp;
if(min>temp)
min=temp;
}
printf("%llu",max+min);
}
No comments:
Post a Comment