Answer to Question #326339 in C for nile2020

Question #326339

1. Visibly Divisible

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:

  1. Input one integer.
  2. Make a conditional statement that contains the following conditions:
  3. If the integer is only divisible by 3, print "Divisible by 3"
  4. If the integer is only divisible by 4, print "Divisible by 4"
  5. If the integer is divisible by both 3 and 4, print "Divisible by 3 and 4"

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
1
Expert's answer
2022-04-11T07:44:16-0400
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS