-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions2.txt
More file actions
85 lines (60 loc) · 1.49 KB
/
functions2.txt
File metadata and controls
85 lines (60 loc) · 1.49 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
q1)
function tellFortune(noc,pn,gl,jt)
{
var output="You will be a "+ jt +"in" + gl +",and married to " + pn + "with" + noc +" kids";
console.log(output);
}
tellFortune(1,Ann,America,Doctor);
tellFortune(2,Bob,Bombay,Engineer);
tellFortune(3,Carol,China,lawyer);
q2)
function calculateDogAge(age,rate)
{
var nnage=age*rate;
var output="Your doggie is "+nnage+ "years old in dog years."
console.log(output);
}
calculateDogAge(3,2);
calculateDogAge(7,7);
calculateDogAge(5,7);
q3)
function calculateSupply(age,amount)
{
var maximumage=90;
var ysup=amount*365;
var rest=maximumage-age;
var totalsupply=ysup * rest;
var output="You will need" + totalsupply + "to last you until the ripe old age of " + maximummage;
console.log(ouput);
}
calculateSupply(40,25);
calculateSupply(50,22);
calculateSupply(45,13);
q4)
function calcCircumfrence(radius)
{
var circ=2*3.14*radius;
var output="The circumference is" + circ;
console.log(output);
}
function calcArea(radius)
{
var area=3.14*radius*radius;
var output="The area is " + area;
console.log(output);
}
q5)
function celsiustoFahrenheit(cel)
{
var far =((cel * 9)/5)+32;
var output= cel"C is " + fah "F";
console.log(output);
}
function Fahrenheittocelcius(fah)
{
var cel =((fah-32)*5)/9;
var output= fah "F is " + cel "C ";
console.log(output);
}
}
}