Algorithm Sample - Multiple of the numbers that are inserted by the user


package algorithmsample22;

import java.util.Scanner;

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

    public static void main(String[] args) {
        int number = 0;
        int result = 1;
        String data = "";

        try {
            Scanner scan = new Scanner(System.in);
            for (int i = 1; i <= 5; i++) {
                System.out.println("Enter the number: "+i);
                data = scan.nextLine();
                number = Integer.parseInt(data);
                result = result * number;
            }
            System.out.println("Multiple of the numbers that are inserted by the user: " + result);
        } catch (Exception e) {
            System.err.print(e);
        }
    }
}

Comments

Popular posts from this blog

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

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