Write a C++ program to check whether the number is odd or even.
kaushikvidit007:
Write in C language not C++
Answers
Answered by
12
Check this...
You may change the format accordingly...
You may change the format accordingly...
Attachments:
Answered by
6
#include<iostream.h>
using namespace std;
int main()
{
int num;
cout<<"Enter the number:" ;
cin >> num;
if(num%2 == 0)
{
printf("Number is Even");
}
else
{
printf("Number is odd");
}
return 0;
}
<Hope this helps --!>
using namespace std;
int main()
{
int num;
cout<<"Enter the number:" ;
cin >> num;
if(num%2 == 0)
{
printf("Number is Even");
}
else
{
printf("Number is odd");
}
return 0;
}
<Hope this helps --!>
#include<stdio.h>
int main()
{
int num;
printf("Enter the number:");
scanf("%f",& num);
if(num%2 == 0)
{
printf("Number is Even");
}
else
{
printf("Number is odd");
}
return 0;
getch();
}
Similar questions