12 Nov 2009

Lagest Number


How to search largest number???



#include <iostream.h>

#include <conio.h>

void main ()

{

int a, b, c, d;

cout<<"Insert First Number!!! ";cin>>a;

cout<<"2nd Number ";cin>>b;

cout<<"3th Number ";cin>>c;

cout<<"4th Number ";cin>>d;

if (a>=b&&a>=c&&a>=d)

    {

cout<<"Largest num is "<<a;

}

else if (b>=a&&b>=c&&b>=d)

    {

cout<<"Largest num is"<<b;

}

else if (c>=a&&c>=b&&c>=d)

    {

cout<<"Largest num is"<<c;

}

else

{

cout<<"Largest num isr"<<d;

}

getch();

}

0 comments:

Post a Comment

 

C++ Language Learning Design by Insight © 2009