-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCH_05_PRATICE_SET.java
More file actions
147 lines (75 loc) · 1.43 KB
/
Copy pathCH_05_PRATICE_SET.java
File metadata and controls
147 lines (75 loc) · 1.43 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
import java.util.Scanner;
public class CH_05_PRATICE_SET {
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");
}
*/
//SUM OF EVEN NUMBER
/*int sum = 0;
int n= 3;
for (int i =0;i<n;i++)
sum=sum+2*i;
{
System.out.println("The sum is " + sum );
}
*/
// table
/*Scanner sc = new Scanner(System.in);
int a= sc.nextInt();
for (int i=0;i<=10;i++)
{
System.out.printf("%dX%d=%d \n " ,a,i,a*i);
}
*/
// TABLE OF 10 IN REVERSE ORDER
/*int a = 10;
for (int i =10;i>=1;i--)
{
System.out.printf("%dX%d=%d\n" ,a,i,a*i);
}
*/
// FACTORIAL OF 5
/* int a = 1;
int n=5;
for (int i=1;i<=n;i++)
a=a*i;
{
System.out.println("THE FACTORIAL OF 5 IS" );
System.out.println(a);
}*/
//Using while loop
/*
int factorial=1;
int i=1;
int n=5;
while (i<=n) {
factorial*=i;
i++;
System.out.println(factorial);
}
*/
//SUM OF TABLE 8
/*int a=8;
int b=0;
for (int i =1;i<=10;i++)
b=b+a*i;
{
System.out.println(b);
}
*/
// SUM OF THE EVEN NUMBER USING WHILE LOOP
/* int a= 1;
int sum = 0;
while (a<=3)
{
sum +=a*2;a++;
System.out.println(sum);
}
*/
}
}