Friday, August 17, 2018

NEWTON SCIENTIST

  • Problem Description

    Newton was one of the great scientist. The Indian council decided that we need to assign some number as a gift to the great scientist.

    There was a suggestion given by the Indian Council. If the number is divided by 1 and by itself that they can assign the number to the great scientist.

    Kindly help the Indian Council to complete the task by writing a simple logic.

    Refer sample Input and Output:
    Input 1: 13
    Output: Give to Scientist Newton


    Input 2: 25
    Output: Dont Give to Scientist Newton
  • CODING ARENA
  • #include <stdio.h>
    int main()
    {
      int n,i,flag=0;
      scanf("%d",&n);
      for(i=2;i<=n/2;i++)
      {
        if(n%i==0)
        {
          flag=1;
          break;
        }
      }
      if(flag==0)
        printf("Give to Scientist Newton");
      else
        printf("Dont Give to Scientist Newton");

    return 0;
    }
  • Test Case 1

    Input (stdin)
    13
    
    
    Expected Output
    Give to Scientist Newton
  • Test Case 2

    Input (stdin)
    10
    
    
    Expected Output
    Dont Give to Scientist Newton

No comments:

Post a Comment