‘C’ program to find the maximum number from an array of n integers.
C File =>
/* Write ‘C’ program to find the maximum number from an array of n
integers. */
#include<stdio.h>
int main()
{
int num[30],i,max=0,n;
printf("\n How many integers? ");
scanf("%d",&n);
printf("\n Enter integers :\n");
for(i=0;i<n;i++)
scanf("%d",&num[i]);
for(i=0;i<n;i++)
{
if(max<num[i])
max=num[i];
}
printf("\n Maximum of given numbers is : %d",max);
return 0;
}
Comments
Post a Comment
Please do not enter any spam link in message.