URI Online Judge | 1044 Multiples (Solution)

Problem Link:
https://www.urionlinejudge.com.br/judge/en/problems/view/1044

URI Online Judge | 1044

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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdio.h>
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;
}

Comments

  1. please what about this code??!!
    it shows me 40% wrong answer

    #include
    using namespace std;

    int main()
    {
    int A , B;
    cin>>A>>B;

    if ( (A % 2 == 0) && (B % 2 == 0) && (B % A == 0) && (A != 0) && (B != 0) )
    cout<<"Sao Multiplos"<<endl;
    else
    cout<<"Nao sao Multiplos"<<endl;

    return 0;
    }

    ReplyDelete
  2. #Elbana
    I think , it's a bit complex condition .

    ReplyDelete
  3. #include
    using namespace std;
    int main()
    {
    int a,b;
    cin>>a>>b;
    if(b%a==0)
    {
    cout<<"Sao Multiplos"<<endl;
    }
    else
    {
    cout<<"Nao sao Multiplos"<<endl;
    }



    return 0;
    }
    what about this code

    ReplyDelete

Post a Comment

Popular posts from this blog

URI Online Judge | 1036 Bhaskara's Formula (Solution)

URI Online Judge | 1043 Triangle (Solution)

URI Online Judge | 1042 Simple Sort (Solution)