Problem :
Multiples
Adapted by Neilor Tonin, URI
Brazil
Timelimit: 1
Brazil
Read two values (A and B). After, the program should print the message "Sao Multiplos" (are multiples) or"Nao sao Multiplos" (aren’t multiples), corresponding to the read values.
Input
The input has two integer numbers.
Output
Print the message relative to the input as stated above.
| Sample Input | Sample Output |
| 6 24 | Sao Multiplos |
| 6 25 | Nao sao Multiplos |
Solution:
#include <stdio.h> int main() { int A, B; scanf("%d %d",&A, &B); if (A<B) { if(B%A == 0) { printf("Sao Multiplos\n"); } else { printf("Nao sao Multiplos\n"); } } else if (A>B) { if(A%B == 0) { printf("Sao Multiplos\n"); } else { printf("Nao sao Multiplos\n"); } } return 0;}
No comments:
Post a Comment