Write an algorithm which takes 3 numbers and calculates their sum and product
Answers
Answer:
import java.util.Scanner;
public class maths
{
public static void main(String[] args)
{
int a, b, c, sum;
Scanner in = new Scanner(System.in);
System.out.println("Input the three numbers");
System.out.println("Input the first number");
a=in.nextInt();
System.out.println("Input the second number");
b=in.nextInt();
System.out.println("Input the third number");
c=n.nextInt();
sum=a+b+c;
prod=a*b*c;
System.out.println("This is the sum of three numbers "+sum);
System.out.println("This is the product of three numbers "+prod);
}
}
Explanation:
Hey Friend, I have made the program according to your question..
This program basically does is that it prints sum and product of any three numbers which user will give using Scanner class..
I hope you like my answer and also follow for more and please mark my answer as Brainliest