Posted by Materi Teknik Informatika • Informasi Teknologi Informasi • Digital Marketing on 9/21/2014
import java.util.Scanner;
public class Prak_305 {
public static void main(String[] args) {
Scanner masukan = new Scanner (System.in);
int n=0, total=0, bil=9;
while (bil !=0){
n++;
System.out.println("Masukan bilangan ke-"+n+" :");
bil = masukan.nextInt();
total +=bil;
}
System.out.print("Total jumlah " +(n-1)+"bilangan tsb :");
System.out.print(total);
}
}