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

Classes in OOP (Object Oriented Programming)

A small airline has just purchased a computer for its new automated reservations system. You’ve been asked to program the new system. You are to write a program to assign seats on each flight of the air line’s only plane (capacity: 10 seats).