[URI Online Judge] – 1044 – Multiples

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 <cstdio>
int main(){
 int a, b;
 scanf("%d %d", &a, &b);
 if (a % b == 0 || b % a == 0)
 printf("Sao Multiplos\n");
 else
 printf("Nao sao Multiplos\n");
 return 0;
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s