Write a program to check whether a number is even or odd. plzz answer it
Anonymous:
in which language?
Answers
Answered by
2
This is a C++ Program :-
____________________________________________________________________
#include<iostream.h>
#include<conio.h>
#include<math.h>
#include<stdlib.h>
void main()
{
clrscr();
int x ;
cout<<"Enter any Number " ;
cin>>x;
if(n%2==0)
cout<<"Your number is even ";
else
cout<<"Your number is odd";
getch();
}
____________________________________________________________________
____________________________________________________________________
#include<iostream.h>
#include<conio.h>
#include<math.h>
#include<stdlib.h>
void main()
{
clrscr();
int x ;
cout<<"Enter any Number " ;
cin>>x;
if(n%2==0)
cout<<"Your number is even ";
else
cout<<"Your number is odd";
getch();
}
____________________________________________________________________
Answered by
1
heya!
here's your answer!
_______________________
__________
____
this is a java program :-
public class display
{
public static void main (String ar[])
{
int num= Integer.parseInt ( ar[0]) ;
if (num % 2 == 0)
{
System.out.println(number + " is an Even Number");
}
else
{
System.out.println(number + " is an Odd Number");
}
}
}
here's your output too :-
Input :
number = 2
(if we input a no. 2 in terminal window)
Output:
2 is an Even Number
Input :
number = 7
(if we input 7 in the terminal window)
Output:
7 is an Odd Number
_______________________
__________
____
HOPE THIS HELPS YOU:)
ANVI GOTTLIEB
BRAINLY BENEFACTOR:)
here's your answer!
_______________________
__________
____
this is a java program :-
public class display
{
public static void main (String ar[])
{
int num= Integer.parseInt ( ar[0]) ;
if (num % 2 == 0)
{
System.out.println(number + " is an Even Number");
}
else
{
System.out.println(number + " is an Odd Number");
}
}
}
here's your output too :-
Input :
number = 2
(if we input a no. 2 in terminal window)
Output:
2 is an Even Number
Input :
number = 7
(if we input 7 in the terminal window)
Output:
7 is an Odd Number
_______________________
__________
____
HOPE THIS HELPS YOU:)
ANVI GOTTLIEB
BRAINLY BENEFACTOR:)
Similar questions