C Program Maximum of n numbers

This is a simple program to find the maximum of n numbers . This is a part of Mumbai University MCA Colleges  C Programs MCA Sem 1

#include<stdio.h>
#include<conio.h>
void main()
{
int max,n,num,i;
clrscr();
printf("How many numbers you want to input?\n");
scanf("%d",&n);
printf("Enter the number  ");
scanf("%d",&num);
max=num;
for(i=0;i<(n-1);i++)
{
printf("Enter the number  ");
scanf("%d",&num);
max=(max<num)?num:max;
}
printf("\nThe maximum number is %d",max);
getch();
}

Hope this Program is useful to you in some sense or other. Keep on following this blog for more Mumbai University MCA College Programs. Happy Programming and Studying.

No comments:

Post a comment