-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathAverage Marks
53 lines (31 loc) · 1.07 KB
/
Average Marks
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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.
Sample Input 1 :
A
3 4 6
Sample Output 1 :
A
4
JAVA CODE:-
import java.util.*;
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 sc=new Scanner(System.in);
String name=sc.next();
int a=sc.nextInt();
int b=sc.nextInt();
int c=sc.nextInt();
System.out.println(name);
int d=a+b+c;
int e=d/3;
System.out.println(e);
}
}