Computer Science, asked by vijayapalinioudc4g, 1 year ago

Write a program to check whether a number is even or odd. plzz answer it


Anonymous: in which language?
vijayapalinioudc4g: this program is for 9th class
vijayapalinioudc4g: i don't know which language is used in 9th class
Anonymous: I know C++
vijayapalinioudc4g: it's ok no problem

Answers

Answered by Anonymous
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();
}
____________________________________________________________________

Answered by AnviGottlieb
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:)

vijayapalinioudc4g: may i know who reported u r answer
AnviGottlieb: i don't know
AnviGottlieb: bit if my answer helps u please mark me as BRAINLIEST
Similar questions