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
Post a Comment