Friday, May 3, 2019

Doll Show

  • Problem Description

    In London, Every year during Dasara there will be a very grand doll show. People try to invent new new dolls of different varieties. The best sold dolls creator will be awarded with cash prize . So people broke their head to create dolls innovatively .Knowing this competition, Mr. LokPaul tried to create a doll which sings only when a even number is pressed and the number should not be zero and greater than 100.

    So write a C program to help mr. Lokpaul to win.

    Input format:

    Input consists of 1 integer which corresponds to Number pressed by the user to the doll.

    Output format :

    Display whether the doll will a sing or not. Output consists of the string "Doll will sing" or "Invalid Number"

    Refer sample input and output for further formatting specifications.
  • Test Case 1

    Input (stdin)
    56

    Expected Output
    Doll will sing
  • Test Case 2

    Input (stdin)
    102

    Expected Output
    Invalid Number
Solution

#include<stdio.h>
int main(){
  int n;
  scanf("%d",&n);
  if((n>1)&&(n<=100))
     {
       if(n%2==0)
       {
         printf("Doll will sing");
       }
       else
         printf("Invalid Number");
     }
  else 
    printf("Invalid Number");
  return 0;
}
  

No comments:

Post a Comment

Parity

Problem Description Ram and Sita playing the parity game. Two types of parity are there. One is odd parity and next is even parity. Ram will...