Wednesday, October 21, 2020

c program to display if the given number is odd (2 different methods)

First Method:

#include <stdio.h>

int main()

{

    int n;

    printf("Enter a number:");

    scanf("%d", &n);

    if(n%2!=0)

    {

        printf("Number=%d is odd",n);

    }

}


Second Method:

#include <stdio.h>

int main()

{

    int n;

    printf("Enter a number:");

    scanf("%d", &n);

    if(n%2==1)

    {

        printf("Number=%d is odd",n);

    }

}

No comments:

Post a Comment

Learning to Appreciate the Right People ❤️ | A Life Lesson About Gratitude, Friendship & Kindness

  https://www.youtube.com/watch?v=FdWsa0QwO2w Hi, namaste camo. So uh recently I have been experiencing this and it has changed a really uh ...