Computer Science, asked by raja40cena, 1 year ago

write a program to assign a number and print "even" or "odd" usimg ternary operator

Answers

Answered by maharaj123
3
import java.util.*;
class EvenOdd
{
public static void main(String args[])
{
Scanner ob=new Scanner(System.in);
System.out.println("Enter a number");
int n=ob.nextInt;
System.out.println(n/2==0?"Even number": "Odd");
}
}

maharaj123: Mr. Sona plz mark my answer as brainliest bhai plz
raja40cena: nahi bhai
Answered by manoj2425
0

Answer:

#include<iostream>

using namespace std;

int main()

{

 int n;

 cin>>n;

 (n%2==0) ?cout<<"Even":cout<<"Odd";

}Explanation:

Similar questions