micher43

E6.2 part C

Oct 24th, 2014
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.45 KB | None | 0 0
  1. public class E62 {
  2.  
  3.     public static void main(String[] args) {
  4.         Scanner s = new Scanner(System.in);
  5.         System.out.println("enter your number of inputs");
  6.         int numberOfInputs = s.nextInt();
  7.         int cumulativeTotal = 0;
  8.        
  9.         for(int i=1; i <= numberOfInputs; i++)
  10.         {
  11.             System.out.println("enter input value");
  12.             int inputValue = s.nextInt();
  13.             cumulativeTotal = cumulativeTotal + inputValue;
  14.             System.out.println(cumulativeTotal);
  15.         }
  16.        
  17.  
  18.     }
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment