/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package lab12_calebfontenot;

/**
 *
 * @author caleb
 */
public class TestBreak2 {
    public static void main(String[] args) {
        int sum = 0,
            number; // Define number here intead of inside the for loop so that 'number' doesn't get removed from memory the second the for loop is broken out of.
        
        for (number = 0; number < 20; number++) {
            if (sum >= 100) {
                break;
            }
            
            sum += number;
            System.out.println("Current sum: " + sum);
        }
            
        System.out.println("\nThe number is " + number);
        System.out.println("The sum is " + sum);
    }
}
