Answer to Question #315311 in Java | JSP | JSF for Chris

Question #315311

Write a program that accept three numbers, 

multiply the first and the third numbers 

and divide the results by the second number. 

The output for the program should be as follows:

 The first number is 

The second number is 

The third number is 

Result is


1
Expert's answer
2022-03-21T12:35:31-0400
import java.util.Scanner;

public class Calculate {
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        System.out.print("Enter first number: ");
        int first=scan.nextInt();
        System.out.print("Enter second number: ");
        int second=scan.nextInt();
        System.out.print("Enter third number: ");
        int third=scan.nextInt();
        double calculating=(double)(first*third)/second;
        System.out.println("The first number is: "+first);
        System.out.println("The second number is: "+second);
        System.out.println("The third number is: "+third);
        System.out.printf("The result is: %.2f",calculating);
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS