Write a program in java to input marks of three subjects and calculate total and average.
Answers
Answered by
13
Explanation:
output:
enter the marks in three subjects
34
45
67
sum of marks =146 Average =48.666
Attachments:
Answered by
3
To write a program in java to input marks of three subjects and calculate total and average.
Explanation:
import java.util.*;
class sum
{ public static void main(string x{ })
{
Scanner sc = new scanner (system .in);
system.out.println(" Enter the marks in three subjects");
int a1 = sc .nextInt( );
int a2 = sc .nextInt( );
int a3 = sc .nextInt( );
double sum a1 + a2 + a3;
double average sum 13.0;
System.out.println (" Sum of the marks = "Sum + "Average = "+Average
}
}
Similar questions