write a program to assign a number and print "even" or "odd" usimg ternary operator
Answers
Answered by
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");
}
}
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
Answered by
0
Answer:
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
(n%2==0) ?cout<<"Even":cout<<"Odd";
}Explanation:
Similar questions