Skip to main content

C++ Program If..else Statement Example

If..else Statement  Program C++



#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
    int b;//variable declaration
    cout<<"enter  the number :";
    cin>>b;
    // condition check
    if(b>10)
    {
        cout<<b<<"is greater than 10";
    }
    getch();
    return 0;
}

Output

Enter the number : 11
11 is greater than 10

Comments

Popular posts from this blog

C++ Program Finding The Absolute Value

#include<iostream> using namespace std; int main() { cout<<" enter any number"; cin>>num; if(num>0) { cout<<"The absolute value of number is:"<< num; } else { cout<<"The absolute value of number is :"<< -(num); } return 0; } OUTPUT Enter Any number: 2 The absolute value of number is 2