#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int n,lrg,a;
cout<<"Enter the number of numbers : ";
cin>>n;
cout<<"Enter a number : ";
cin>>lrg;
while(n>1)
{
cout<<"Enter a number : ";
cin>>a;
if(a>lrg)
lrg=a;
n--;
}
cout<<"Largest number is : "<<lrg;
getch();
}
#include<conio.h>
void main()
{
clrscr();
int n,lrg,a;
cout<<"Enter the number of numbers : ";
cin>>n;
cout<<"Enter a number : ";
cin>>lrg;
while(n>1)
{
cout<<"Enter a number : ";
cin>>a;
if(a>lrg)
lrg=a;
n--;
}
cout<<"Largest number is : "<<lrg;
getch();
}
No comments:
Post a Comment