divide by one number
#include <stdio.h>
int main()
{
int num;
printf("Enter any number: ");
scanf("%d", &num);
if((num % 5 == 0)
{
printf("Number is divisible by 5");
}
else
{
printf("Number is not divisible by 5");
}
return 0;
}
------------------------------------------------------
divide by two number
#include <stdio.h>
int main()
{
int num;
printf("Enter any number: ");
scanf("%d", &num);
if((num % 4 == 0) && (num % 21 == 0))
{
printf("Number is divisible by 4 and 21");
}
else
{
printf("Number is not divisible by 4 and 21");
}
return 0;
}
check whether a number is even or odd
No comments:
Post a Comment