Algorithm


Problem Name: beecrowd | 1044
Problem Link: https://www.beecrowd.com.br/judge/en/problems/view/1044

Multiples

Adapted by Neilor Tonin, URI Brazil

Timelimit: 1

Read two nteger 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 relative message to the input as stated above.

Input Sample Output Sample

6 24

Sao Multiplos

 

6 25

Nao sao Multiplos

Code Examples

#1 Code Example with C Programming

Code - C Programming

 
#include<stdio.h>
int main()
{
    int A, B;
    scanf("%d %d", &A, &B);
    if (B % A == 0 || A % B == 0)
    {
        printf("Sao Multiplosn");
    }
    else
    {
        printf("Nao sao Multiplosn");
    }
    return 0;
}

Copy The Code & Try With Live Editor

Input

x
+
cmd
6 24

Output

x
+
cmd
Sao Multiplos

#2 Code Example with C++ Programming

Code - C++ Programming



#include <iostream>
using namespace std;

int main()
{
    int x, y;

    cin >> x >> y;

    if(x < y){
    if(y % x == 0){cout << "Sao Multiplos" << endl;}
    else{cout << "Nao sao Multiplos" << endl;}
    }else{
    if(x % y == 0>{cout << "Sao Multiplos" << endl;}
    else{cout << "Nao sao Multiplos" << endl;}
    }

    return 0;
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
6 25

Output

x
+
cmd
Nao sao Multiplos

#3 Code Example with Java Programming

Code - Java Programming



iimport java.util.Scanner;

public class Main {
    public static void main(String[] args){ 
        int A, B;
        Scanner input =new Scanner(System.in);
        A = input.nextInt();
        B = input.nextInt();
        if (B % A == 0 || A % B == 0) {
        System.out.print("Sao Multiplosn");
        }else {
        System.out.print("Nao sao Multiplosn");
        }
    } 
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
6 24

Output

x
+
cmd
Sao Multiplos

#4 Code Example with Java Programming

Code - Java Programming


a,b=map(int, input().split())
if (a%b==0)or(b%a==0):
    print("Sao Multiplos")
else:
    print("Nao sao Multiplos")
Copy The Code & Try With Live Editor

Input

x
+
cmd
6 25

Output

x
+
cmd
Nao sao Multiplos
Advertisements

Demonstration


Previous
#1043 Beecrowd Online Judge Solution 1043 Triangle- Solution in C, C++, Java, Python and C#
Next
#1045 Beecrowd Online Judge Solution 1045 Triangle Types- Solution in C, C++, Java, Python and C#