If-Else program in C/C++

If-Else program in C/C++




This program is made conditional by using If-Else statement. In this program, the user can enter a number and that is checked whether it is an even or odd.

#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int num;
cout <<"enter a number:";
cin >> num;
if ((num%2)==0)
    {
    cout << "even number";
}
else
{
cout << "odd number";
}
}

Comments

Popular posts from this blog

Book-Shop Program using C++

Nesting of For Loop in C/C++

Switch statement in C/C++