-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
163 lines (136 loc) · 4.44 KB
/
app.js
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
// Chapter No 5 : Math Expressions
//Q5) Write a program that take two numbers and add them in a new variable.Show the result in your browser.
// var num1=3;
// var num2=5;
// var result=num1+num2;
// console.log("Sum of "+ num1+" and "+ num2+" is "+result)
//Q2) Repeat task1 for subtraction, multiplication, division and modulus.
// var num1=3;
// var num2=5;
// //Subtraction
// console.log("Subtraction of "+num1+" and "+num2+" is "+(num1-num2));
// //Multiplication
// console.log("Multiplication of "+num1+" and "+num2+" is "+(num1*num2));
// //Division
// console.log("Division of "+num1+" and "+num2+" is "+(num1/num2));
// //Multiplication
// console.log("Modulus of "+num1+" and "+num2+" is "+(num1%num2));
//Q3) Do the following using JS Mathematic Expressions
//a) Declare a variable
//b) Show the value of variable in your browser like "Value after variable declaration is:??".
//c) Initialize the variable with some number.
//d) Show the value of variable in your browser like "Initial value: 5".
//e) Increament the variable.
//f) Show the value of variable in your browser like "Value after increament is: ??"
//g) Add 7 to the variable.
//h) Show the value of variable in your browser like "value after addition is: 13".
//i) Decrement the variable.
//j) Show the value of variable in your browser like "Value after decrement is: 12"'
//k) Show the remainder after dividing the variable value by 3.
//l) Output: "The remainder is : 0".
// //a)
// var num1;
// //b)
// console.log("Value after variable declaration is undefined");
// //c)
// num1=20;
// //d)
// console.log("Initial value: "+ num1);
// //e)
// num1++;
// //f)
// console.log("Value after increment is: "+num1);
// //g)
// num1+=7;
// //h)
// console.log("Value after addition is: "+num1);
// //i)
// num1--;
// //j)
// console.log("Value after decrement is: "+num1);
// //k)
// num1%=3; //num1=num1%3
// //l)
// console.log("The remainder is: "+num1);
// //Q4) in pdf
// var oneTicket=600;
// var numofTickets=5;
// console.log("Total cost to buy "+numofTickets+" tickets to a movie is "+oneTicket+"PKR");
// //Q5) in pdf
// //Table of 4
// console.log("Table of 4");
// var num=4;
// console.log("4x1="+(num*1));
// console.log("4x2="+(num*2));
// console.log("4x3="+(num*3));
// console.log("4x4="+(num*4));
// console.log("4x5="+(num*5));
// console.log("4x6="+(num*6));
// console.log("4x7="+(num*7));
// console.log("4x8="+(num*8));
// console.log("4x9="+(num*9));
// console.log("4x10="+(num*10));
// //Q6)
// var celsius=25;
// var fahrenheitConversion=(celsius*9/5)+32;
// var fahrenheit=70;
// var celsiusConversion=(fahrenheit-32)*5/9;
// console.log(celsius+"C"+" is "+fahrenheitConversion+"F");
// console.log(fahrenheit+"F"+" is "+celsiusConversion+"C");
// //Q7)
// console.log("Shopping Cart");
// var p1=650;
// var p2=100;
// var oQ1=3;
// var oQ2=7;
// var shipCharges=100;
// var total=(oQ1*p1)+(oQ2*p2)+shipCharges;
// console.log("Price of item 1 is "+p1);
// console.log("Quantity of item 1 is "+oQ1);
// console.log("Price of item 2 is "+p2 );
// console.log("Quantity of item 2 is "+oQ2);
// console.log("Shipping Charges "+shipCharges);
// console.log("\n\nTotal cost of your order is "+total);
// //Q8)
// console.log("Mark Sheet");
// var total_marks=980;
// var obtain_marks=804;
// var percentage=(obtain_marks/total_marks)*100;
// console.log("Total Marks: "+total_marks);
// console.log("Marks obtained: "+obtain_marks);
// console.log("Percentage: "+percentage+"%");
// //Q9)
// console.log("Currency in PKR");
// var dollars=10;
// var riyals=25;
// var pkr=(10*104.80)+(25*28);
// var totalCurrency=pkr;
// console.log("Total Currency in PKR: "+totalCurrency);
// //Q10)
// var numb=1;
// var results=numb+5;
// results*=10;
// results/=2;
// console.log(results);
// //Q11)
// console.log("Age calculator");
// var currentYear=2024;
// var birthyear=2006;
// var age1=2024-2006;
// var age2=age1-1;
// console.log("They are either "+age1+" or "+age2+" years old");
// //Q12)
// console.log("The Geometrizer");
// var radius=20;
// var circumference=2*3.142*radius;
// var area=3.142*radius*radius;
// console.log("Radius of a circle: "+radius);
// console.log("The circumference is "+circumference);
// console.log("The area is "+area);
// //Q13)
// var favSnack="pringles";
// var currentAge=15;
// var maxAge=65;
// var snackQ=3;
// var totalSnack=((maxAge-currentAge)*snackQ);
// console.log("You will need "+totalSnack+" "+favSnack+" to last you until the ripe old age of "+maxAge+".");