-
Notifications
You must be signed in to change notification settings - Fork 0
/
assignment1.js
57 lines (31 loc) · 956 Bytes
/
assignment1.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
// program to check leap year
function checkLeapYear(year) {
//three conditions to find out the leap year
if ((0 == year % 4) && (0 != year % 100) || (0 == year % 400)) {
console.log(year + ' is a leap year');
} else {
console.log(year + ' is not a leap year');
}
}
// take input
// const year = prompt('Enter a year:');
checkLeapYear(2022);
// answer = 2022 is not a leap year
// convert temperatures to and from Celsius to Fahrenheit
const caltemp = function(){
// enter tem here
const temp = 60;
const cl = (temp * (9/5)+32);
console.log(` ${temp}°C is ${cl} °F`);
}
caltemp();
// factorial of a number
let fact= 1;
const findFactorial = function (){
const number = 6 ;
for (let i = 1 ; i<=number ; i++){
fact = fact*i;
}
console.log(`Factorial of ${number} is : ${fact}`);
}
findFactorial();