File tree 6 files changed +120
-0
lines changed
6 files changed +120
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Wap to Find Area of Triangle
2
+ # Formula Based Questions
3
+ # Hardcoding: whenevr you give direct values to your variables this process is called Hardcoding
4
+
5
+ # Area = (0.5) * Base * Height
6
+
7
+ Base = 20
8
+
9
+ Height = 40
10
+
11
+ Area_Triangle = (0.5 ) * Base * Height
12
+
13
+ print ("Area of Triangle is = " , Area_Triangle )
Original file line number Diff line number Diff line change
1
+ # Addition Prog. in Script Mode Script Mode
2
+
3
+ # Hardcoding: Whenever in your programme you assign direct Value to a Variable.
4
+ # This Is CAlled Hard Coding
5
+
6
+
7
+ A = 10
8
+
9
+ B = 20
10
+
11
+ C = A + B
12
+
13
+ print ("Addition Result is = " , C )
Original file line number Diff line number Diff line change
1
+ # Wap to Find Area of Circle
2
+ # Formula Based Questions
3
+
4
+ # Area = 3.14 * radius * radius
5
+
6
+ radius = 23
7
+
8
+ Area_Circle = 3.14 * radius * radius
9
+
10
+ print ("Area of circle is = " , Area_Circle )
Original file line number Diff line number Diff line change
1
+ # Wap to Find Simple Intrest
2
+ # Formula Based Questions
3
+
4
+ # SI = (P*R*T)/100
5
+
6
+ P = 20000
7
+
8
+ R = 20
9
+
10
+ T = 3
11
+
12
+ SI = (P * R * T )/ 100
13
+
14
+ print ("Simple Intrest= " , SI )
Original file line number Diff line number Diff line change
1
+ # Wap to Swap 2 Numbers
2
+
3
+ # Hardcoding: whenevr you give direct values to your variables
4
+ # this process is called Hardcoding
5
+
6
+ # logic based Question
7
+
8
+
9
+ A = 20
10
+
11
+ B = 45
12
+
13
+ Temp = 0
14
+
15
+ print ("Before Swap Value of A is = " , A )
16
+ print ("Before Swap Value of B is = " , B )
17
+
18
+ # logic For Swap 2 Values
19
+
20
+ Temp = A # Temp = 20
21
+
22
+ A = B # A = 45
23
+
24
+ B = Temp # B = 20
25
+
26
+
27
+ print ("After Swap Value of A is = " , A )
28
+ print ("After Swap Value of B is = " , B )
29
+
Original file line number Diff line number Diff line change
1
+ # Wap to Swap 2 Numbers without using Thired/Temp Variable
2
+
3
+ # Hardcoding: whenevr you give direct values to your variables
4
+ # this process is called Hardcoding
5
+
6
+ # logic based Question
7
+
8
+
9
+ A = 20
10
+
11
+ B = 45
12
+
13
+ print ("Before Swap Value of A is = " , A )
14
+ print ("Before Swap Value of B is = " , B )
15
+
16
+ # logic For Swap 2 Values Without Temp
17
+
18
+ A = A + B # A = 20+45 => A = 65
19
+
20
+ B = A - B # B = 65-45 => B = 20
21
+
22
+ A = A - B # A = 65-20 => A = 45
23
+
24
+
25
+ print ("After Swap Value of A is = " , A )
26
+ print ("After Swap Value of B is = " , B )
27
+
28
+
29
+
30
+ C = 80
31
+
32
+ D = 75
33
+
34
+ print ("Before Swap Value of C is = " , C )
35
+ print ("Before Swap Value of D is = " , D )
36
+
37
+ C , D = 75 , 80
38
+
39
+
40
+ print ("After Swap Value of C is = " , C )
41
+ print ("After Swap Value of D is = " , D )
You can’t perform that action at this time.
0 commit comments