Write a ‘C’ program to accept n numbers from user, store these numbers into an array & find the maximum & minimum number from that array

#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
int i,n,max=0,min=0;
int a[100];
clrscr();
printf("Enter the limit:\n");
scanf("%d",&n);
printf("Enter the Value:\n");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
max=min=a[0];
for(i=0;i<n;i++)
{
if(a[i]>max)
max=a[i];
if(a[i]<min)
min=a[i];
}
printf("\nmaximum=%d\n\nminimum=%d",max,min);
getch();
}


Comments

  1. i want to know program to find the maximum of n numbrs without storing them into an array.

    ReplyDelete
  2. i want to know program to find the maximum of n numbrs without storing them into an array.

    ReplyDelete

Post a Comment