-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAverage.java
More file actions
35 lines (30 loc) · 753 Bytes
/
Copy pathAverage.java
File metadata and controls
35 lines (30 loc) · 753 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
import java.util.*;
class Average {
Scanner sc = new Scanner(System.in);
int n1;
int n2;
int n3;
float avr;
void getdata() {
System.out.print("Enter first number: ");
n1 = sc.nextInt();
System.out.print("Enter second number: ");
n2 = sc.nextInt();
System.out.print("Enter Third number: ");
n3 = sc.nextInt();
}
void avrcal() {
avr = (n1 + n2 + n3) / 3f;
}
void printdata() {
System.out.print("Average of this three number is: " + avr);
}
}
class Qs6 {
public static void main(String[] rds) {
Average ar = new Average();
ar.getdata();
ar.avrcal();
ar.printdata();
}
}