Wednesday, March 18, 2020

  • Session

    Input & Ouput
  • Question ID

    1111210048 : key gaming
  • 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.
  • Logic Test Case 1

    Input (stdin)
    11 30
    
    60
    
    
    
    
    
    
    Expected Output
    accept
    
    
    
    
  • Logic Test Case 2

    Input (stdin)
    20 30
    
    60
    
    
    
    
    Expected Output
    strong






#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;
}

No comments:

Post a Comment

cisco Cybersecurity Essentials Quiz 8 answer in bold

Question  1 Correct Mark 2.00 out of 2.00 Flag question Question text A company has had several incidents involving users downloading unauth...