Beginner Beginners Problems > Ad-hoc

Given a positive integer n. Turist has asked you to calculate the following sum in the most efficient way : Sum= 1 + 2 + 3 +……........ + n Input ----- The first line of input contains an integer T(1<=1000) denoting the number of test cases. The description of T test cases follows.The only line describing each test case contains a single integer n (1<=n<=10^8) . Output ------ For each test case, output a single line containing one integer . Sample Input ------------ 4 3 2 1 10 Sample Output ------------- 6 3 1 55

Anowar Hossain Anu

Language |
Time Limit (seconds) |

C | 1.00 |

C++ | 1.00 |

C++14 | 1.00 |

C# | 3.00 |

Go | 3.00 |

Java | 3.00 |

JavaScript | 3.00 |

Objective-C | 3.00 |

Perl | 3.00 |

PHP | 3.00 |

Python | 3.00 |

Python3 | 3.00 |

Ruby | 3.00 |

VB.Net | 3.00 |

Solve/Submission

# | User | Language | Timing |
---|---|---|---|

01 | Beauty | Cpp14 | 0.00s |

02 | Sharif_42 | Cpp14 | 0.00s |

03 | Aman_khan | Cpp14 | 0.00s |

04 | Salty_Coder | Cpp14 | 0.00s |

05 | joy25896 | Cpp14 | 0.00s |

06 | seyedssz | Cpp14 | 0.00s |

07 | Indro_BU | Cpp14 | 0.00s |

08 | JubayerSohel | Cpp14 | 0.00s |

09 | jayed_al_hasan | Cpp14 | 0.00s |

10 | Mehedi07 | Cpp14 | 0.00s |

11 | maxhasan | Cpp14 | 0.00s |

12 | gazi93 | Cpp14 | 0.00s |

13 | terminator_c | Cpp14 | 0.00s |

14 | Eucalyptus | Cpp14 | 0.00s |

15 | tssovi | Cpp14 | 0.00s |

16 | nurul_islam | Cpp14 | 0.00s |

17 | rezaul_karim | Cpp14 | 0.00s |

18 | Nurul_CSE | Cpp14 | 0.00s |

19 | SakibAlamin | Cpp14 | 0.00s |

20 | sadia2427 | Cpp14 | 0.00s |

21 | rayhan50001 | Cpp14 | 0.00s |

22 | gulzar | Cpp14 | 0.00s |

23 | Avijeet | Cpp14 | 0.00s |

24 | Anubis | Cpp14 | 0.00s |

25 | jim1 | Cpp14 | 0.00s |

26 | HM39 | Cpp14 | 0.00s |

27 | rafsandevs | Cpp14 | 0.00s |

28 | gsshanto | Cpp14 | 0.00s |

29 | Core_i14 | Cpp14 | 0.00s |

30 | non_coder | Cpp14 | 0.00s |

31 | robin_aust | Cpp14 | 0.00s |

32 | Koushik54 | Cpp14 | 0.00s |

33 | tico88612 | Cpp14 | 0.00s |

34 | Alamgir_Hossain | Cpp14 | 0.00s |

35 | junayedmahmud | Cpp14 | 0.00s |

36 | Not_Found0001 | Cpp14 | 0.00s |

37 | rabiulrafi01 | Cpp14 | 0.00s |

38 | afzalul | Cpp14 | 0.00s |

39 | Mahadi024 | Cpp14 | 0.00s |

40 | soumitro_cse1604114 | Cpp14 | 0.00s |

41 | riazul_110 | Cpp14 | 0.00s |

42 | lolcoder | Cpp14 | 0.00s |

43 | monirul_110 | Cpp14 | 0.00s |

44 | smriad | Cpp14 | 0.00s |

45 | mhfarabi09 | Cpp14 | 0.00s |

46 | Mhkhaled | Cpp14 | 0.00s |

47 | MohammadShamim | Cpp14 | 0.00s |

48 | 1604099_ishtiaq | Cpp14 | 0.00s |

49 | 1604131 | Cpp14 | 0.00s |

50 | rabeya1604127 | Cpp14 | 0.00s |

Copyright © 2015-2016 Dev Skill.

Feedback
#### Your feedback is our precious!

## Thank you for providing feedback! Our developers will be happy :)

## Sorry there was a problem when submitting the feedback. Please try again. :(