* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates * and open the template in the editor. */ package javaapplication154; import java.util.Scanner; /** * * @author User */ public class tugas7 { public static void main(String[] args) { boolean running = true; int a = 0; int angka = 0; String lagi; String hasil; Scanner userInput = new Scanner(System.in); while (running){ System.out.println("Angka ?"); System.out.print("Lagi? [y/t]"); lagi = userInput.nextLine(); // cek jawabannya, kalau ya maka berhenti mengulang if(lagi.equalsIgnoreCase("T")){ running = false; } a++; } System.out.println("Total " +a); }