Saturday, 7 February 2015

Write a Program in C++to Find the Greatest one using if statement.

This is a Sequence Structure that may consist of a single statement or a Sequence of Statements with a single entry and single exit. Here is Program in which you can see that there is single entry and single exit. Mean according to the Condition  (i.e. a>b ), if a Greater found then the Result will be the Greater Number a. If b is Greater then there is no other Statement to Print.


#include<iostream.h>

#include<conio.h>

void main()

{
 int a,b;

 clrscr();

 cout<<"enter two no.";

 cin>>a>>b;

 if(a>b)

 {
cout<<"greater is : "<< a;

 }

}

OUTPUT OF THIS PROGRAM IS:





No comments:

Post a Comment