-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain_25.java
More file actions
36 lines (35 loc) · 971 Bytes
/
Main_25.java
File metadata and controls
36 lines (35 loc) · 971 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
public class Main_25 {
public static void main(String[] args) {
for (int i=4; i>0; i--){
for (int j=0; j<i; j++){
System.out.print("*");
}
System.out.print("\n");
}
int sum=0;
int i=1;
while (i<=5){
sum=sum+(2*i);
i++;
}
System.out.println("Sum of first 5 even numbers is: "+sum);
for (int a=1; a<=10; a++){
System.out.println("5x"+a+"="+(5*a));
}
for (int a=10; a>=1; a--){
System.out.printf("10x%d=%d", a, (10*a));
System.out.print("\n");
}
int prod=1, n=6;
while (n>=1){
prod=prod*n;
n--;
}
System.out.println("Factorial of 6 is: "+prod);
int sum2=0;
for (int b=1; b<=10; b++){
sum2=sum2+(8*i);
}
System.out.println("Sum of 10 multiples of 8 is: "+sum2);
}
}