Advertisement
Guest User

K16Nr1IntegerAdiren.java

a guest
May 4th, 2015
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.58 KB | None | 0 0
  1. import java.util.*;
  2. public class K16Nr1IntegerAdiren {
  3.  
  4.     public static void main(String[] args) {
  5.         // TODO Auto-generated method stub
  6.        
  7.         Scanner scan = new Scanner (System.in);
  8.        
  9.         int ergebnis =0,plus,anzahl , i=1;
  10.        
  11.        
  12.        
  13.         System.out.println("Wie oft addiren?");
  14.        
  15.         anzahl=scan.nextInt();
  16.        
  17.        
  18.         while (i <= anzahl ){
  19.             System.out.println("Bitte die " + i +". Zahl die addirt werden soll eingeben :");
  20.             plus=scan.nextInt();
  21.             ergebnis = plus + ergebnis ;
  22.             i++;
  23.                        
  24.         }
  25.        
  26.         System.out.println("Das ergebnis ist : " + ergebnis);
  27.        
  28.        
  29.     }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement