Tuesday, 16 October 2012

how to find larger number using c++


This is source code to find the larger number from given numbers

#include<iostream.h>
#include<conio.h>
main()
{
      int num;
      int larger=0;
      for(int i=1;i<=10;i++){
            cout<<"Enter number"<<i<<":"<<endl;
            cin>>num;
               if(num>larger){
                             larger=num;
                              }
                              }
                              cout<<"larger num is="<<larger<<endl;
                              getch();
}                             
End

No comments:

Post a Comment