-
Notifications
You must be signed in to change notification settings - Fork 0
/
AverageMarks.java
31 lines (22 loc) · 975 Bytes
/
AverageMarks.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Write a program to input a name(as a single character) and marks of three tests as m1, m2, and m3 of a student considering all the three marks have been given in integer format.
//
// Now, you need to calculate the average of the given marks and print it along with the name as mentioned in the output format section.
//
// All the test marks are in integers and hence calculate the average in integer as well. That is, you need to print the integer part of the average only and neglect the decimal part.
import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
/* Your class should be named Solution.
* Read input as specified in the question.
* Print output as specified in the question.
*/
Scanner s = new Scanner(System.in);
String str = s.next();
int m1 = s.nextInt();
int m2 = s.nextInt();
int m3 = s.nextInt();
int sum = m1+m2+m3;
System.out.println(str);
System.out.println(sum/3);
}
}