Advertisement
Benlahbib_Abdessamad

Untitled

Sep 4th, 2015
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.45 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3.  
  4. public class Test {
  5.    
  6.    
  7.    
  8.     public static void main(String args[])
  9.     {
  10.         int i=0;
  11.         double sum=0;
  12.        
  13.         while(i!=1)
  14.         {
  15.             Scanner sc=new Scanner(System.in);
  16.             System.out.print("Legen Sie eine ganze Zahl : ");
  17.             String str=sc.nextLine();
  18.             if(str.equals("Ende"))
  19.             {
  20.                 i=1;
  21.             }
  22.            
  23.             else
  24.             {
  25.                 sum=sum+Double.parseDouble(str);
  26.             }
  27.         }
  28.        
  29.         System.out.println("Summe : " +sum);
  30.        
  31.        
  32.     }
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement