C program to find largest number of a list of numbers entered through keyboard
#include<iostream.h>#include<conio.h>
void main(){ clrscr(); //to clear the screen int i,n,x,large=0; cout<<"How many numbers?"; cin>>n; for(i=0;i<n;++i) { cout<<"
Enter number "<<i+1<<":"; cin>>x; if(x>large) large=x; } cout<<"
The largest number is "<<large; getch();}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.