C++ Program to read 10 number and find Max and Min
#include<iostream.h>
#include<conio.h>
void main()
{
int a,i;
int max=0;
int min=0;
clrscr();
cin>>a;
min=a;
for(i=1;i<=9; )
{
if(a>max)
max=a;
else if(a<min)
min=a;
i++;
cin>>a;
}
cout<<"Max= "<<max;
cout<<"\nMin= "<<min;
getch();
}
#include<conio.h>
void main()
{
int a,i;
int max=0;
int min=0;
clrscr();
cin>>a;
min=a;
for(i=1;i<=9; )
{
if(a>max)
max=a;
else if(a<min)
min=a;
i++;
cin>>a;
}
cout<<"Max= "<<max;
cout<<"\nMin= "<<min;
getch();
}
No comments:
Post a Comment