URI Online Judge | 1044 Multiples (Solution)
Problem Link:
https://www.urionlinejudge.com.br/judge/en/problems/view/1044
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 Input | Sample Output |
6 24 | Sao Multiplos |
6 25 | Nao 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; } |
please what about this code??!!
ReplyDeleteit 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;
}
they don't have to be even numbers.
Delete#Elbana
ReplyDeleteI think , it's a bit complex condition .
#include
ReplyDeleteusing 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