forked from ranjansharma255/Java_Programs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudentDetails.java
More file actions
39 lines (34 loc) · 909 Bytes
/
StudentDetails.java
File metadata and controls
39 lines (34 loc) · 909 Bytes
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
import java.lang.*;
import java.util.Scanner;
import java.io.*;
class StudentDetails{
public static void main(String args[]) throws Exception
{
Scanner s = new Scanner(System.in);
System.out.println("Enter the student name :");
String name = s.nextLine();
System.out.println("Enter How many Subjects");
int n = s.nextInt();
int[] marks = new int[n];
for(int i=0; i<marks.length; i++)
{
System.out.println("Enter the marks");
marks[i] = s.nextInt();
}
System.out.print("The student marks are ");
for(int i=0; i<marks.length; i++)
{
System.out.print(" "+marks[i]);
}
System.out.println("\nTotal marks are");
int tot = 0;
for(int i=0; i<marks.length; i++)
{
tot+= marks[i];
}
System.out.print(tot);
System.out.println("the average marks are");
float avg = (float)tot/n;
System.out.println(avg);
}
}