A program that will ask three numbers and then it will compute the sum, average and product of three given numbers using Java programming language.
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
import java.util.Scanner;
public class LoopSample {
public static void main(String args[]) {
Scanner input = new Scanner(System.in);
double num1=0.00, num2=0.00, num3=0.00;
double sum=0.00, average=0.00, product=0.00;
char c,ch;
do
{
System.out.println();
System.out.println("\tSum,Average, and Product of Three Numbers in Java");
System.out.println();
System.out.print("Enter First Number: ");
num1 = input.nextInt();
System.out.print("Enter Second Number: ");
num2 = input.nextInt();
System.out.print("Enter Third Number: ");
num3 = input.nextInt();
System.out.println();
sum = num1 + num2 + num3;
System.out.println("Sum of these numbers:"+sum);
average = sum / 3;
System.out.println("Average of these number:"+average);
product = num1 * num2 * num3;
System.out.println("Product of these numbers: "+product);
System.out.println();
System.out.print("Do you want to continue? Y/N : ");
c = input.next().charAt(0);
ch = Character.toUpperCase(c);
}while (ch == 'Y');
System.out.println();
System.out.println("Thank you for using this software.");
System.out.println();
input.close();
}
}
No comments:
Post a Comment