1234567891011121314151617181920212223242526272829 |
- import java.util.*;
- /**
- * Created by iyasuwatts on 10/17/17.
- */
- public class Main {
-
- public static void main(String[] args){
-
- int n, sum = 0, i =0;
- Scanner sc = new Scanner(System.in);
- System.out.println("Enter numbers you want to sum");
- n = sc.nextInt();
- int a[] = new int[n];
-
- System.out.println("Enter the " +n+ "numbers ");
- while (i <n)
- {
- System.out.println("Enter number " + (i+1) +":");
- a[i] = sc.nextInt();
- sum += a[i];
- i++;
- }
- System.out.println("sum is =" +sum);
- }
- }
-
-
-
|