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

Matrix multiplication in C

  Matrix multiplication  in C: We can add, subtract, multiply and divide 2 matrices. To do so, we are taking input from the user for row num...