#include<stdio.h>
#include<conio.h>
void main()
{
int i, limit, no[97], max;
clrscr();
printf("How many numbers you want to enter? ");
scanf("%d", &limit);
printf("\nEnter %d numbers one by one\n", limit);
for(i=0; i<limit; i++)
{
printf("Enter number %d: ", i+1);
scanf("%d", &no[i]);
}
max = no[0];
for(i=0; i<limit; i++)
{
if(no[i] > max)
{
max = no[i];
}
}
printf("\n\nMaximum value from a given array is %d", max);
getch();
}
/*
How many numbers you want to enter? 10
Enter 10 numbers one by one
Enter number 1: 23
Enter number 2: 45
Enter number 3: 65
Enter number 4: 78
Enter number 5: 97
Enter number 6: 54
Enter number 7: 33
Enter number 8: 23
Enter number 9: 9
Enter number 10: 99
Maximum value from a given array is 99
*/
No comments:
Post a Comment