TEST - Life, the Universe, and Everything

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.

Example

Input:
1
2
88
42
99

Output:
1
2
88

Information

In case of any problems with your code, you can take a look in the forum, you'll find the answer, only for this problem, in various languages.


Added by:mima
Date:2004-05-01
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All
Resource:Douglas Adams, The Hitchhiker's Guide to the Galaxy

hide comments
2024-12-20 15:25:58
while True:
n = int(input())
if n==42:
break
print(n)
2024-12-20 13:46:57
Agriculture loan schemes in Karnataka[https://paramountfv.in/] support sustainable farming through financial aid for climate-resilient practices, modern technology adoption, and infrastructure development. They promote inclusivity, insurance linkages, and market access while simplifying processes for smallholders. By integrating education and innovation, these schemes empower farmers, ensuring economic growth and resilience in rural communities.
2024-12-16 18:58:03
while True:
num = int(input())
if num == 42:
break
print(num)
2024-12-06 10:49:31
what happens if I comment a slur?
2024-12-04 20:15:18

Procedure Find_Answer is
Number : Integer;
Begin
Loop

Get(Number);


Exit When Number = 42;


Put_Line(Integer'Image(Number));
End Loop;
End Find_Answer;
2024-11-08 08:28:53
hi
2024-10-27 11:27:03
Hi, so how are we supposed to know when to output the numbers? Cuz here it seems arbitrary that there's a 99 at the end. How do we know that we have to output after 99 rather than after 42 directly? Or are we outputting the numbers right after we input them?
2024-09-29 06:46:59
Hello there,
May I know how many exact inputs will be given to the program?. For now I just assumed it as 5, previously I assumed that it has to take inputs until the value "42" is given to it, but both are wrong it seems
2024-09-26 20:27:16
<snip>
tôi sai ở đâu nhỉ ???
[Simes]: remove the "public" on the class declaration.


Last edit: 2024-09-27 00:47:33
2024-09-19 11:13:43
<snip>
whats wrong in this solution i think it should work. i am coding it in java so any java coders help me out
[Simes]: there's nothing wrong with that code. It got AC when I submitted it.

Last edit: 2024-09-19 17:20:23
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.