Life, the Universe, and Everything ! Hacker Earth

Your program is to use the brute-force approach in order to find the Answer to Life, the Universe, and Everything. More precisely... rewrite small numbers from input to output. Stop processing input after reading in the number 42. All numbers at input are integers of one or two digits.


Source Code in C:
#include <stdio.h>  
 int main()  
 {  
   int no;  
   while(1)  
   {  
        scanf("%d", &no);  
        if(no==42)  
             break;  
        else  
        printf("%d\n",no);  
   }  
   return 0;  
 }
SAMPLE INPUT
1
2
88
42
99
SAMPLE OUTPUT
1
2
88

Comments

Popular posts from this blog

Find Product ! Hacker Earth

Seating Arrangement

Roy and Profile picture