NAJCFG - Carl Friedrich Gauss

no tags 

Carl Friedrich Gauss (1777-1855) is recognized as being one of the greatest mathematicians of all time. During his lifetime he made significant contributions to almost every area of mathematics, as well as physics, astronomy and statistics. Like many of the great mathematicians, Gauss showed amazing mathematical skill from an early age, and there are many stories which show how clever he could be.

The most well-known story is a tale from when Gauss was still at primary school. One day Gauss' teacher asked his class to add together all the numbers from 1 to 100, assuming that this task would occupy them for quite a while. He was shocked when young Gauss, after a few seconds thought, wrote down the answer 5050. The teacher couldn't understand how his pupil had calculated the sum so quickly in his head, but the eight year old Gauss pointed out that the problem was actually quite simple.

Now it’s your turn, I will tell you a number N you have to find out the sum of 1 to N.

Input:

Input start with an integer T (T ≤ 100). Each test case contain a integer N (1 ≤ N ≤ 10^9)

Output:

For each case, print the case number and sum of 1 to N.

Sample:

Input

Output

2
10
100

Case 1: 55
Case 2: 5050

 

Authored By: Tanvir Hasan Anick


hide comments
Jacob Plachta: 2014-10-26 04:08:20

Moved to Tutorial.


Added by:Najmuzzaman
Date:2014-10-25
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64