// a simple while-loop example. // this program will print out an encouraging message to a user, // a number of times that is based on how insecure he/she feels import java.util.Scanner; class Insecure2 { public static void main(String[] args) { Scanner s = new Scanner(System.in); int level; System.out.println("How insecure are you, on a scale of 1-10? " + " (where 1 is least insecure, 10 is most)\n> "); level = s.nextInt(); int i = level; // loop control variable while (i > 0) // control condition { System.out.println("i = " + i); System.out.println("You are a good person!!!!"); i--; // decrement the counter } System.out.println("Final value of i = " + i); } }