KEY GAME
Problem Description
Read 2 numbers x and y as input and read a key value. If a key is divisible by either x or y print as accept, if the key is divisible by both x and y print as strong key otherwise print as reject. Key must be greater than x and y. If the key is smaller than x and y print as impossible.
CODING ARENA::
#include <stdio.h>
int main()
{
int x,y,c;
scanf("%d%d%d",&x,&y,&c);
if((c>x)&&(c>y))
{
if((c%x==0) && (c%y==0))
{
printf("strong");
}
else if((c%x==0) || (c%y==0))
{
printf("accept");
}
else
{
printf("reject");
}
}
else
{
printf("impossible");
}
return 0;
}
Test Case 1
Input (stdin)11 30
60
Expected Output
accept
Test Case 2
Input (stdin)20 30
60
Expected Output
strong
No comments:
Post a Comment