15. Write a C program to find out the Maximum and Minimum number from given 10 numbers
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],i,max=0,min=a[0];
printf("Enter 10 numbers:\n");
for(i=0;i<10;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<10;i++)
{
if(max<a[i])
{
max=a[i];
}
}
printf("Max number is: %d\n",max);
for(i=0;i<10;i++)
{
if(min>>a[i])
{
min=a[i];
}
}
printf("Min number is: %d",min);
getch();
}
#OUTPUT:
#include<conio.h>
void main()
{
int a[10],i,max=0,min=a[0];
printf("Enter 10 numbers:\n");
for(i=0;i<10;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<10;i++)
{
if(max<a[i])
{
max=a[i];
}
}
printf("Max number is: %d\n",max);
for(i=0;i<10;i++)
{
if(min>>a[i])
{
min=a[i];
}
}
printf("Min number is: %d",min);
getch();
}
#OUTPUT:
Comments
Post a Comment