Write a program to input no. x, if x is odd display 1 otherwise R by using conditional operator
Answers
Answered by
2
Answer:
Methôd 1 :
#include<iôstream>
#include<cônio.h>
using naméspace std;
înt main(){
char arr[2][5] = {"Even",
"0dd"};
int nô;
côut << "Enter a number: ";
cîn >> no;
côut << arr[nô%2];
getch();
return 0;}
Methôd 2 :
#include<stdiô.h>
int main(){
int nô;
printf("Enter a nô: ");
scanf("%d", &nô);
(nô & 1 && printf("ôdd"))|| printf("even");
return 0;
Methôd 3 :
# côde
n = int(input("Enter a number: "))
prînt("Even" * (n % 2 == 0), "0dd" * (n % 2 != 0))
Explanation:
MARK ME BRAINLIEST PLEASE ❤️
Similar questions