-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpractice.html
86 lines (68 loc) · 2.56 KB
/
practice.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<script>
//write a program to check two numbers and return true if one of the number is 100 or sum of two numbers is 100
// let greet =(a,b)=> a==100 || b==100 || (a+b)==100;
// console.log(greet(100,0));
// console.log(greet(20,40));
// console.log(greet(10,90));
// console.log(greet(10,10));
// console.log(greet(100,10));
// //to write in html page
// document.write("<h1>hello world</h1>")
//adding two numbers
//static number
// let a = 5;
// let b = 6;
// let c = a+b;
// console.log("the sum of " + a +" and "+ b +" is "+ " " +c);
//prompt();
// let a1 = prompt("please enter first number","");
// let b1 = prompt("please enter second number","");
// let c1 = parseInt(a1)+parseInt(b1);
// console.log("the sum of " + a1 +" and "+ b1 +" is "+ " " +c1);
//square root of two numbers
// let n = prompt("please enter a number","");
// var t = Math.sqrt(n);
// console.log(t);
//to find the area of right angeled triangle
// let x = prompt("please enter the base value","");
// let y = prompt("please enter the height value","");
// let area = (x*y)/parseInt(2);
// console.log("The area of the triangle is " + area);
//area of a regular triangle
// let a = prompt("please enter value of a","");
// let b = prompt("please enter value of b","");
// let c = prompt("please enter value of c","");
// let s = (a+b+c)/parseInt(2);
// let temp= s*(s-a)+s*(s-b)+s*(s-c);
// let area=Math.sqrt(temp);
// console.log("The area of triangle is " + area)
//swapping of two numbers using temp
// let a = prompt("please give the value of a","");
// let b = prompt("please give the value of b","");
// console.log(`the value of a: ${a} ,the value of b:${b}`);
// let temp;
// //a=1,b=2
// temp=a;
// a=b;
// b=temp;
// console.log(`After swapping numbers, the value of a: ${a}, the value of b: ${b} `);
//swaping of numbers without temp
let m = parseInt(prompt("please give the value of m",""));
let n = parseInt(prompt("please give the value of n",""));
console.log(`the value of m: ${m} ,the value of n:${n}`);
a=a+b;
b=a-b;
a=a-b;
console.log(`After swapping, the value of m: ${m} ,the value of n:${n}`);
</script>
</html>