Write a program to accept a number and check weather it is divisible by 5 or not
Answers
Answered by
2
Answer:
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.
Explanation:
In c it comes out to be
mark as brainliest .....
#include <stdio.h>
int main()
{
int num;
/* Input number from user */
printf("Enter any number: ");
scanf("%d", &num);
/*
* If num modulo division 5 is 0
* and num modulo division 11 is 0 then
* the number is divisible by 5 and 11 both
*/
if((num % 5 == 0)
{
printf("Number is divisible by 5 ");
}
else
{
printf("Number is not divisible by 5");
}
return 0;
}
Similar questions