Algorithm Sample - Sum of the numbers from 1 to 100(1 and 100 included)


package algorithmsample2;

/**
 *
 * @author Nurhak
 */
public class AlgorithmSample2 {

    public static void main(String[] args) {
        int total = 0;
        int x = 0;
        for (x = 1; x <= 100; x++) {
            System.out.println("Immediate Total: " + total);
            total = total + x;
        }
        System.out.println("************************");
        System.out.println("Total: " + total);
    }
}

Comments

Popular posts from this blog

Solution for "Can not obtain Oracle client information from registry"

Solution for the fault: "System.Diagnostics.Process.Start is not working on IIS, but working on ASP.NET Development Server"