Advertisement
Guest User

Stuff

a guest
Oct 1st, 2014
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.58 KB | None | 0 0
  1. /* Georg Farrugia 4G
  2.  *
  3.  * Write a program that asks the user to input 10 int numbers, store them
  4.  * in an array
  5.  */
  6. public class array{
  7.     public static void main(String args[]){
  8.         int a [];
  9.         a = new int[9];
  10.         int tot = 0;
  11.         for(int i = 0; i <= 8; i ++){
  12.             System.out.print("Number: " + (i + 1));
  13.             a[i] = Keyboard.readInt();
  14.             tot = tot + a[i];
  15.         }
  16.        
  17.         for(int i = 0; i <= 8; i ++){
  18.             System.out.println(a[i]);
  19.         }
  20.        
  21.         System.out.println("Total is: " + tot);
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement