Repository navigation
Expand file tree
/
Copy pathproblem-solving-que.js
More file actions
96 lines (77 loc) · 1.95 KB
/
Copy pathproblem-solving-que.js
File metadata and controls
96 lines (77 loc) · 1.95 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
// A steel is graded according to:
// Rockwell hardness > 50
// Carbon content > 0.7
// Tensile strength > 5600 kg/cm²
// Grades:
// Grade 10: All three conditions satisfied
// Grade 9: Conditions (i) and (ii)
// Grade 8: Conditions (ii) and (iii)
// Grade 7: Conditions (i) and (iii)
// Grade 0: Otherwise-----------------------------------------------
// const hardness = 60
// const carbon = 0.2
// const tensile = 6000
// let h = hardness > 50
// let c = carbon > 0.7
// let t = tensile > 5600
// if(h && c && t){
// console.log("Grade 10");
// }else if(h && c){
// console.log("Grade 9")
// }else if(c && t){
// console.log("Grade 8")
// }else if(h && t){
// console.log("Grade 7")
// }else{
// console.log("Grade 0")
// }
// Take the three properties of 5 steel samples using a loop and determine the grade of each sample.
// for(i = 0; i <= 5; i++){
// const hardness = 60
// const carbon = 0.2
// const tensile = 6000
// let h = hardness > 50
// let c = carbon > 0.7
// let t = tensile > 5600
// if(h && c && t){
// console.log("Grade 10");
// }else if(h && c){
// console.log("Grade 9")
// }else if(c && t){
// console.log("Grade 8")
// }else if(h && t){
// console.log("Grade 7")
// }else{
// console.log("Grade 0")
// }
// }
// Write a Python program that takes a number n and prints a square pattern of * with n rows and n columns.--------------------------
// Input: 4
// Output:
// ****
// ****
// ****
// ****
// let n = 3
// for(i = 0; i <= n; i++){
// console.log("***");
// }
// Write a Python program that takes a number n and prints a right-angled triangle pattern.
// Input: 5
// Output:
// *
// **
// ***
// ****
// *****
let n = 4
for(i = 0; i <= n; i++){
}
// Write a Python program that takes a number n and prints the following number pattern using nested loops.
// Input: 5
// Output:
// 1
// 12
// 123
// 1234
// 12345// Ques3: