Array sum without loops
Array sum without loops easy asked in interviews by 2 companies Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Array sum without loops easy asked in interviews by 2 companies Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Problem Statement:
Given an array of n integers. Print the sum of all numbers in the array without using any loop. Input First line contains a single integer denoting n. Next line contains n space separated integer.
Constraints 1 <= n <= 105 1 <= arr[i] <= 109 Output A single integer denoting the sum. Example Input: 4 3 9 2 7
Output: 21
link: