0% found this document useful (0 votes)
43 views2 pages

Program 4

This C++ program asks the user to enter a number and then determines whether it is even or odd. It uses the modulo (%) operator to check if the number is evenly divisible by 2, and then prints either "even" or "odd" depending on the result. The purpose is to implement a program that can identify whether a user-input number is even or odd.

Uploaded by

harry221992
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views2 pages

Program 4

This C++ program asks the user to enter a number and then determines whether it is even or odd. It uses the modulo (%) operator to check if the number is evenly divisible by 2, and then prints either "even" or "odd" depending on the result. The purpose is to implement a program that can identify whether a user-input number is even or odd.

Uploaded by

harry221992
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

PROGRAM-4

TASK-WAP to find weather a no. entered by user is even or odd.

PURPOSE – By implementing this program we are capable to find weather


entered no. Is even or odd.

#include<iostream.h>

#include<conio.h>

int main()

int a;

cout<<"enter a no.:";

cin>>a;

if(a%2==0)

cout<<"no. is p";

else

cout<<"odd";

getch();

}
OUTPUT-

You might also like