Skip to main content

C Program to Check a Whether a Number is Divisible by 5 or Not

 C Program to Check a Whether a Number is Divisible by 5 or Not

         In this program we will check a number entered by the user will be divisible by 5 or Not. We have solved this problem using if-else statement.



Program:


#include<stdio.h>
#include<conio.h>
int main()
{
    int x;
    printf("Enter a number");
    scanf("%d",&x);
    if(x%5==0)
        printf("The number %d is divisible by 5",x);
    else
        printf("The number %d is not divisible by 5",x);
    return 0;
}



Output:


C Program to Check a Whether a Number is Divisible by 5 or Not



NOTE: You Can Comment Your Code if you have solved differently and we will pin it in the comment section.  Let's Learn together. 


MOTTO: 

You Learn, I Learn together We Learn.

 

Comments