HackerRank A very Big Sum Problem Solution C Solution
#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> int main() { int n; long int sum = 0; unsigned int a[10]; scanf("%d",&n); for(int i=0; i<n; i++){ scanf("%ui",&a[i]); sum = sum + a[i]; } printf("%li",sum); return 0; }
HackerRank A very Big Sum Problem Solution JavaScript Solution
function processData(input) { //Enter your code here var splitFirst = input.split('\n'); var toCount = splitFirst[1].split(" "); var total = 0; toCount.forEach(function (number){ total += parseInt(number); }); console.log(total); } process.stdin.resume(); process.stdin.setEncoding("ascii"); _input = ""; process.stdin.on("data", function (input) { _input += input; }); process.stdin.on("end", function () { processData(_input); });
0 Comments