-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyInfo.java
More file actions
73 lines (67 loc) · 1.59 KB
/
MyInfo.java
File metadata and controls
73 lines (67 loc) · 1.59 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
public class MyInfo
{
public static void main (String[] args) {
//Variables
int age = 17;
int a = 0;
int b = 0;
int c = 0;
int d = 0;
int e = 0;
int f = 0;
int g = 0;
int sum = 0;
int sum_2 = 0;
int avg = 0;
int diff = 0;
int pro = 0;
double quo = 0;
int x = 0;
int y = 0;
//Initialized variables
a = 12;
b = 32;
c = 35;
d = 54;
e = 65;
f = 76;
g = 98;
//Equations
sum = a+b+c+d+e+f+g;
avg = sum / 7;
sum_2 = a+g;
diff = g-a;
pro = a*g;
quo = g/a;
//Printed text
System.out.println ("several random numbers:");
// print 7 random numbers
while(y>7);
{
x = (int)Math.random()*10+1;
System.out.println (+ x );
y = y+1;
}
do
{
x = (int)Math.random()*10+1; }
System.out.println (+ x );
System.out.println (+ b );
System.out.println (+ c );
System.out.println (+ d );
System.out.println (+ e );
System.out.println (+ f );
System.out.println (+ g );
System.out.println ("the average is "+ avg);
System.out.println ("The sum, difference, product, and quotient of the first and last numbers:");
System.out.println ("First number is "+ a);
System.out.println ("the last number is "+ g);
System.out.println ("the sum is "+ sum);
System.out.println ("the difference is "+ diff);
System.out.println ("the product is "+ pro);
System.out.println ("the quotient is "+ quo);
System.out.println ("My age is "+ age);
System.out.println ("B");
System.out.println ("my favorite book is COSMOS - By Carl Segan");
}
}