Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- public class SumationOfArray {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- int n,i;
- int sum =0;
- System.out.print("Enter How Many Number You Want To Insert : ");
- n = input.nextInt();
- int arr[] = new int [n];
- System.out.println("Enter Your "+n+ " Numbers");
- for(i = 0;i < n; i++)
- {
- arr[i]= input.nextInt();
- }
- for(i = 0; i<n; i++)
- {
- sum = sum + arr[i];
- }
- System.out.println("Sumation : "+sum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement