Welcome

Hi! This blog is for beginners of c++ and java .You can check and pick codes for your programming assignments. This will also help you to understand the concepts of these programming languages. Its all about programming.

If Else Practice(Greator or lesser number Check)

Wednesday, May 18, 2011

#include <iostream.h>
#include <conio.h>
int main ()
{
    clrscr ();
    int a,b;
    cout << "Enter First Number : ";
    cin >> a;
    cout << "\nEnter Scond Number : ";
    cin >> b;
    cout <<endl;
    if (a>b)
    {
        cout << a << " Is Greater Then "<< b <<endl;
    }
    else if (a<b)
    {
        cout << a << " Is Less Then "<< b <<endl;
    }
    else
    {
        cout << a <<" Is Equal To "<< b <<endl;
    }
    if (a<0)
    {
        cout <<" First Number "<< a <<" Is Negative" <<endl;
    }
    else if (a>0)
    {
        cout <<" First Number "<< a <<" Is Positive " <<endl;
    }
    if (b<0)
    {
        cout <<" Scend Number "<< b <<" Is Negative" <<endl;
    }
    else if (b>0)
    {
        cout <<" Scond Number "<< b <<" Is Positive" <<endl;
    }
    getch();
    return 0;
}