Hackerrank solution Simple Array Sum - Solution in C | Algorithms > Warmup
HackerRank Online Judge Solution Simple Array Sum| Data structures
HackerRank Main Problem Link - https://www.hackerrank.com/challenges/simple-array-sum
Problem Name: HackerRank Problem Simple Array Sum
Problem Number : HackerRank Problem Simple Array Sum
Online Judge : HackerRank Online Judge Solution
Category: Algorithm
Solution Language : C, C plus plus
HackerRank Solution Simple Array Sum Code in C:
#include <stdio.h> int main(){ int n, sum = 0; scanf("%d",&n); int arr[n]; //take the value for(int arr_i = 0; arr_i < n; arr_i++){ scanf("%d",&arr[arr_i]); } //print the sum for(int arr_i = 0; arr_i < n; arr_i++){ sum += arr[arr_i]; } printf("%d\n", sum); return 0; }
No comments:
Post a Comment