/* FIND THE MAXIMUM VALUE WITH IN THE ARRAY */
#include<stdio.h>
#include<conio.h>
main()
{
int i,n,a[10],max;
clrscr();
printf("\n Enter the array size:");
scanf("%d",&n);
printf("\n Enter the array elements:");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
max=a[1];
for(i=0;i<n;i++)
{
if(a[i]>max)
max=a[i];
}
printf("\n The maximum element in given array is %d",max);
getch();
}
No comments:
Post a Comment