-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
49 lines (43 loc) · 1.01 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
//Q.1
function time(){
let date = new Date();
document.write(date)
}
time()
//Q.2
function greets(firstName,lastName){
var firstName = "Bilal";
var lastName = "Ahmed";
console.log(firstName +" "+ lastName);
}greets()
//Q.3
function user(){
var user = +prompt("Enter your number")
var user2 = +prompt('Enter your number')
document.write(user + user2)
}user()
//Q.4
function userInput(){
var usernum = +prompt("Enter your first number")
var opretor = prompt("Enter your opreator")
var usernum2 = +prompt("Enter your second number")
if(opretor == "+"){
var result = usernum + usernum2;
document.write(result)
}else if(opretor == "-"){
var result = usernum - usernum2;
document.write(result)
}
else if(opretor == "*"){
var result = usernum * usernum2;
document.write(result)
}
else if(opretor == "/"){
var result = usernum / usernum2;
document.write(result)
}
else if(opretor == "%"){
var result = usernum % usernum2;
document.write(result)
}
}userInput()