pages

Saturday, 17 April 2021

c-program | program to check weather a number is divisible by 2,3,9 in c-language.

 program to check weather a number is divisible by 2,3,9 in c-programing?

In this program , we will now taking input from the number and to check weather a number is divisible by 2,3,9 in c-programming .


A number is exactly divisible by some other number if it gives 0 as remainder. To check if a number is exactly divisible by some number we need to test if it leaves 0 as remainder or not.


#include<stdio.h>
#include<conio.h>
main()
{
    int a;
    printf("enter a number");
    scanf("%d",&a);
    if(a%2==a%3==a%9==0)
        printf("%d is divisible by 2,3,9",a);
    else
        printf("%d is not divisible by 2,3,9",a);
    getch();
}

output:- 


        enter a number  a=36
     the 36 is divisible by  2,3,9.

For more c-programming :-

1.c-program check weather a number is divisible by 4,6,9.








No comments:

Post a Comment