Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package project;
- import java.util.Scanner;
- import java.math.*;
- public class newTest {
- static Scanner scanner = new Scanner(System.in);
- public static int sum(int []a) {
- int num = 0;
- for(int i =0;i < a.length;i++) {
- num = num + a[i];
- }
- return num;
- }
- public static void main(String[] args) {
- int a[] = {1,2,3,4};
- int x = sum(a);
- System.out.println(x);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement