Wednesday, April 3, 2024

//C program to check whether a number is divisible by 2 and 9 or not


#include <stdio.h>

int main()

{

    int num;   

    printf("Enter any number: ");

    scanf("%d", &num);


//if(!(num % 2) && !(num % 9))

    if((num % 2 == 0) && (num % 9 == 0))

    {

        printf("Number is divisible by 2 and 9");

    }

    else

    {

        printf("Number is not divisible by 2 and 9");

    }

    return 0;

}


//Enter any number: 18

//Number is divisible by 2 and 9


No comments:

Post a Comment

Programming in C

  PDF Download Links University Question Papers Notes Laboratory Manual Record Important Questions and Question Bank Important Questions Pro...