Simple example : Decision making

#include <iostream.h>
#include <conio.h>
void main( )
{
int num1, num2;
clrscr();
cout<<”Enter two numbers\n”;
cin>>num1>>num2;
if(num1 > num2 )
cout<<”Largest =”<< num1<<”\n”;
else
cout<<”Largest =”<< num2<<”\n”;
getch();
}
Output :
Enter two numbers
10 20
Largest = 20

0 comments: