Wednesday, December 2, 2015

Uri problem 1044 solve

Problem :

Multiples

Adapted by Neilor Tonin, URI  Brazil
Timelimit: 1
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 InputSample Output
6 24Sao Multiplos
6 25Nao 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