➽ Problem:-
https://www.hackerrank.com/challenges/simple-array-sum/problem
➽ Solution:-
import
java.io.*;
import
java.util.*;
import
java.text.*;
import
java.math.*;
import
java.util.regex.*;
public class
Solution
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int Number = sc.nextInt();
int sum = 0;
for(int i=0; i<Number; i++)
{
sum = sum + sc.nextInt();
}
System.out.println(sum);
}
}
0 Comments
Please do not enter any spam link in the comment section.