codegamy_logo

CODELAB

3. The King's Treasure

Long ago, in the ancient kingdom of Numaria, King Numerion had n treasure chests. Each chest contained a certain number of gold coins.

On the night before the annual festival, the king wanted to know how rich he truly was. He asked you, his royal scribe, to calculate the total number of coins in all the treasure chests.

Given an integer n and n integers representing the number of coins in each chest, print the sum of all coins.

Input Format

The first line contains a single integer n — the number of treasure chests.

The second line contains n space-separated integers a1, a2, ..., an — the number of coins in each chest.

Output Format

Print a single integer: the total number of coins.

Sample Input

5
10 20 30 40 50

Sample Output

150

Constraints:

  • 1 ≤ n ≤ 1000
  • 0 ≤ ai ≤ 104
Python
Dark
14

Custom Input

Output

Custom Input

Output

3. The King's Treasure

Long ago, in the ancient kingdom of Numaria, King Numerion had n treasure chests. Each chest contained a certain number of gold coins.

On the night before the annual festival, the king wanted to know how rich he truly was. He asked you, his royal scribe, to calculate the total number of coins in all the treasure chests.

Given an integer n and n integers representing the number of coins in each chest, print the sum of all coins.

Input Format

The first line contains a single integer n — the number of treasure chests.

The second line contains n space-separated integers a1, a2, ..., an — the number of coins in each chest.

Output Format

Print a single integer: the total number of coins.

Sample Input

5
10 20 30 40 50

Sample Output

150

Constraints:

  • 1 ≤ n ≤ 1000
  • 0 ≤ ai ≤ 104
Python
Dark
14

Custom Input

Output

Custom Input

Output

2025 © CodeLab(PSTU) | All Rights Reserved.

Developed by Hasib-17❤️