forked from pikachu-17/java-projects
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathp1.java
More file actions
36 lines (29 loc) · 829 Bytes
/
p1.java
File metadata and controls
36 lines (29 loc) · 829 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
import java.util.*;
public class marksss
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter the number of elements");
int n=sc.nextInt();
int marks[]=new int[n];
String names[]=new String[n];
double avg=0;
int sum=0;
double dev=0.0d;
for(int i=0;i<n;i++)
{
System.out.println("Enter the marks");
marks[i]=sc.nextInt();
names[i]=sc.next();
sum=marks[i]+sum;
}
avg=sum/n;
for(int i=0;i<n;i++)
{
dev=avg-marks[i];
System.out.println("Deviation of"+names[i]+"is"+marks[i]);
}
System.out.println("average is"+avg);
}
}