#include<stdio.h>
#include<conio.h>
void main(void)
{
int a[50], max, min, i, n;
clrscr( );
printf("Enter how many integers do u want? :");
scanf(" %d", &n);
for( i=0; i< n ; i++)
{
printf("\nEnter the %d number: ", i );
scanf(" %d", &a[ i ]);
if(i==0)
{
max=a[i ]; min=a[i ];
}
if(a[ i]>max)
max= a[i ];
if(a[i ]< min)
min= a[i ];
}
printf("\n Maximum : %d", max);
printf("\n Minimum : %d", min);
getch( );
}
#include<conio.h>
void main(void)
{
int a[50], max, min, i, n;
clrscr( );
printf("Enter how many integers do u want? :");
scanf(" %d", &n);
for( i=0; i< n ; i++)
{
printf("\nEnter the %d number: ", i );
scanf(" %d", &a[ i ]);
if(i==0)
{
max=a[i ]; min=a[i ];
}
if(a[ i]>max)
max= a[i ];
if(a[i ]< min)
min= a[i ];
}
printf("\n Maximum : %d", max);
printf("\n Minimum : %d", min);
getch( );
}
No comments:
Post a Comment