Saturday, September 3, 2016

// // Leave a Comment

Odd Or Even C Program

Question: Write a program that reads an integer and determines and prints whether it’s odd or even. [Hint: Use the remainder operator. An even number is a multiple of two. Any multiple of two leaves a remainder of zero when divided by 2.]
 * Website: 
 * Program to determine if number is odd or even.

#include <stdio.h>
int main ( ){ 
    int num;
    printf("Enter an integer number: ");
    scanf("%d", &num);
    if (num%2==0){
       printf("%d is an even number.\n", num);
    if (num%2==1){
       printf("%d is an odd number.\n", num);
    return 0;
Click here to see other solutions to Deitel C How To Program exercises.


Post a Comment

DISCLAIMER: Opinions expressed in comments are those of the comment writers alone and does not reflect or represent the views of the post author. We reserve the right to delete any post deemed inappropriate or offensive and/or spammy. Please do not use abusive words/hate speech.

I Appreciate your valuable Feedback. So, Please DO NOT SPAM - Spam comments will be deleted immediately.

Don't use brand name in name field and you're not allowed to use links in comments unless it's necessary. Such comments will be removed immediately. To get notified of replies or follow-up comments, click the box next to notify me.