Math, asked by palaksahu399, 8 months ago

write a program to input a number and check whether it is even or odd​

Answers

Answered by nkyadav2013
1

Answer:

hi

Step-by-step explanation:

Program to Check Even or Odd

#include <stdio.h>

int main() {

int num;

printf("Enter an integer: ");

scanf("%d", &num);

// True if num is perfectly divisible by 2

if(num % 2 == 0)

printf("%d is even.", num);

else

printf("%d is odd.", num);

return 0;

}

Output

Enter an integer: -7

-7 is odd.

Answered by shomekeyaroy79
4

#include <stdio.h>

int main() {

int num;

printf("Enter an integer: ");

scanf("%d", &num);

// True if num is perfectly divisible by 2

if(num % 2 == 0)

printf("%d is even.", num);

else

printf("%d is odd.", num);

return 0;

}

Output

Enter an integer: -7

-7 is odd.

#coder pro

Similar questions