C Program to find maximum and minimum of entered ’n’ number using arrays

CWC
0 Min Read
#include<stdio.h>
#include<conio.h>
main( )
{
int i,n,a[10],min,max;
clrscr( );
printf(“ enter how many number”);
scanf(“%d”,&n);
printf(“enter the elements”);
for(i=0;i<n;i++)
scanf(”%d”,&a[i]);
min=a[0];
for(i=0;i<n;i++)
if(min>a[i])
min=a[i];
printf(“minimum=%d”,min);
max=0;
for(i=0;i<n;i++)
if(max<a[i]);
max=a[i];
printf(“\n maximum=%d”,max);
getch( );
}

 

Share This Article
Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

English
Exit mobile version