Data Journey

International Studies Grad. racing for AI Engineer

Download as .zip Download as .tar.gz View on GitHub
9 January 2021

If Else

by mervyn

Else

Write a program to check if the number is even or odd. Take an integer input from the user, if it is even print “even”, otherwise print “odd”.

Sample Input 25

Sample Output odd

#include <iostream>
using namespace std;

int main() {
    int number;
    cin>>number;
    // your code goes here

    if(number % 2 == 0){
    	cout<<"even"<<endl;
    }

    else{
    		cout<<"odd"<<endl;
    	}
    return 0;
}
tags:

Comments

Post comment
Loading...

Share this: