Write code to check if a number is even or odd.

AnswerBot
1y

A code to check whether a number is even or odd.

  • Use the modulo operator (%) to check if the remainder of the number divided by 2 is 0.

  • If the remainder is 0, the number is even. Otherwise, it is odd.

Arnab Pal
2y

#include<stdio.h>

int main()

{

int a;

printf("entr your favorite number");

scanf("%d",&a);

if(a%2==0){

printf("the number is even\n");

}

else{

printf("number is odd");

}

return 0;

}

Help your peers!
Select
Add answer anonymously...

Popular interview questions of Jda Wms Consultant

A Jda Wms Consultant was asked Q1. What is natural language processing?
A Jda Wms Consultant was asked Q2. Write code to check if a number is even or odd.
A Jda Wms Consultant was asked Q3. What is cloud computing?
TCS Jda Wms Consultant Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits