A program that is required to three (3) numbers. calculate and print their total is given below:
<h3>The Program</h3>
import java.util.Scanner;
public class SumAndAverage {
public static void main(String[ ] args) {
System.out.println("Enter three numbers - ");
// Accepting and finding sum of numbers.
int sum = 0;
Scanner sc = new Scanner(System.in);
for (int i = 0; i < 3; i++)
sum += sc.nextInt( );
// Printing sum and average.
System.out.println("Sum - " + sum);
System.out.println("Average - " + (sum / 3f));
}
}
The output would request three different numbers, then add them up, and display the output of the sum and then display or print their total
Read more about programming here:
brainly.com/question/23275071
#SPJ1
Answer:
Code is too large , i attached a source file below and also a text file from where i get Questions
Explanation:
Answer:
double x = 2.5;
double y = -1.5;
int m = 18;
int n = 4;
string s = "Storm";
string t = "Watch";
The output of the expression "x + n*y - (x+n)*y" is "6.25".
and the output of expression "m/n + m%n" is "6".
Explanation:
for the first expression,
x + n*y - (x+n)*y ,put value of every variables in it.
=2.5+4*(-1.5)-(2.5+4)*(-1.5)
=2.5-6.0-(6.5*(-1.5)
=-3.5+9.75
=6.25
for the second expression,
m/n + m%n, put value of every variables in it.
=18/4 +18%4
=4+2 ("/ will give quotient and % will give remainder")
=6
Is it asking for a web site like .edu? or something like that?