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

The Power of a Genuine Compliment: A Small Kindness That Can Change Your Day 😊

  https://www.youtube.com/watch?v=i1gDGLY4kC8 Hi, namaste. Kamcho. So, uh I was just thinking like I was working now. It's almost going ...