Sunday, March 13, 2022

Product of Two Numbers in Scala

 Machine Problem

Write a program that will ask the user to give two numbers, and then the program will compute, and display the product of the two numbers on the screen.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.


My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

Thank you very much for your support.




Program Listing

/* product.scala
   Prof. Jake Rodriguez Pomperada, MAED-IT, MIT
   www.jakerpomperada.blogspot.com and www.jakerpomperada.com
   jakerpomperada@gmail.com
   October 31, 2021    Sunday  2:28 PM
   Bacolod City, Negros Occidental
 */

import java.util.Scanner;

object product {
   
    def main(args: Array[String]) : Unit = {
   
        var scanner = new Scanner(System.in);
   
        print("\n\n");
        print("\tProduct of Two Numbers in Scala");
        print("\n\n");  
        print("\tEnter the first number : ");
        var a = scanner.nextInt();
       
        print("\n");
        print("\tEnter the second number : ");
        var b = scanner.nextInt();

        var product = (a*b);
       
        print("\n");
        println("\tThe product of " + a + " and " + b + " is " + product +".");
        print("\n");
        print("\tEnd of Program");
        print("\n\n");
       
    }
}

No comments:

Post a Comment