Wednesday 9 March 2016

DOLL SHOW


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 doll's 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 be not be zero and greater than 100.
So write a program to help Mr.Lokpaul to win.

Input Format: 
Input Consists of Single Integer which Corresponds to Number pressed by the user to the doll.

Output Format: 
Display whether the doll will Sing or not. Output consists of the string "Doll will sing" or "Invalid number".

Sample Input and Output: 
[All text in bold corresponds to input and the rest corresponds to output.]
Press a number:
56
Doll will sing

Code:

  #include<stdio.h>
int main(){
  int n;
  printf("Press a number:\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