Problem Description
Find biggest value in the array using pointers in CCODING ARENA
#include <stdio.h>
int main()
{
int a[100],n,c,maximum;
scanf("%d",&n);
for(c=0;c<n;c++)
scanf("%d",&a[c]);
maximum=a[0];
for(c=1;c<n;c++)
{
if(a[c]>maximum)
{
maximum=a[c];
}
}
printf("%d",maximum);
return 0;
}
Test Case 1
Input (stdin)2 58 98
Expected Output98
Test Case 2
Input (stdin)3 100 80 10
Expected Output100
No comments:
Post a Comment