by CodeChum Admin
Do you still know what being divisible by a certain number means? In case you forgot, being divisible means that the number is capable of being divided by another number without a remainder. With this knowledge, you can surely solve this problem!
Instructions:
Input
1. An integer
Output
The first line will contain a message prompt to input the integer.
The second line contains the appropriate message.
Enter·n:·6
Divisible·by·3
#include <stdio.h>
int main() {
int n;
printf("Enter n: ");
scanf("%d", &n);
if (n%3 == 0 && n%4 != 0)
printf("Divisible by 3");
if (n%3 != 0 && n%4 == 0)
printf("Divisible by 4");
if (n%3 == 0 && n%4 == 0)
printf("Divisible by 3 and 4");
return 0;
}
Comments
Leave a comment