Write a program in Java to accept the marks of 5 subjects and print the sum and average.
Please text only if you know the answers.
This question is not for gaining free points.
It is a request.
Answers
Answered by
1
Explanation:
import java.util.Scanner;
import static java.lang.System.out;
public class AverageOfNumber
{ public static void main(String args[ ]) {
Scanner Sc= new Scanner(System.in);
out.println("Enter 1st number");
float a=Sc.nextFloat();
out.println("Enter 2nd number");
float b=Sc.nextFloat();
out.println("Enter 3rd number");
float c=Sc.nextFloat();
out.println("Enter 4th number");
float d=Sc.nextFloat();
out.println("Enter 5th number");
float e=Sc.nextFloat();
float avg= (a+b+c+d+e)/5;
out.println("Calculated average sum of five numbers is: "+avg);
}
}
hope this will help you.....
Similar questions
English,
3 months ago
Math,
3 months ago
Chemistry,
7 months ago
Math,
1 year ago
CBSE BOARD XII,
1 year ago