Showing posts with label LOOPS. Show all posts
Showing posts with label LOOPS. Show all posts

Friday, March 28, 2014

C++ program to find largest number using counter

#include<iostream.h>
#include<conio.h>
int main()
{
 clrscr();
 int counter=0,number,largest;
 cout<<"Enter first number";
 cin>>largest;
 while(++counter<10){
  cout<<"Enter next number:"<<endl;
 cin>>number;
 if(number>largest)
 largest=number;
 }
 cout<<"Largest is\n"<<largest<<endl;
 getch();
 return 0;
 }