-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday6.html
More file actions
36 lines (33 loc) · 779 Bytes
/
day6.html
File metadata and controls
36 lines (33 loc) · 779 Bytes
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
//WAP to find the sum of odd nos.
//WAP to find the sum of odd nos.
let sumodd = parseInt(prompt("Enter the value of n:"));
let summ=0;
let sumoddnumber=(n)=>{
for(var i=1;i<=n;i++){
if(i%2!==0){
summ+=i;
console.log("required sum:",summ);
}
}
}
sumoddnumber(sumodd);
//WAP to find sum and average of a given series of number
WAP to find sum and average of a given series of number
let average=parseInt(prompt("Enter the value of n:"));
let summm=0;
let avg;
let sumandavg=(n)=>{
for(var i=1;i<=n;i++){
summm+=i;
avg=summm/n;
console.log("reqired answer:",summm);
}
}
sumandavg(average);*/
/*var myVar=100;
function WholsThis(){
var myVar=200;
//alert(myVar);
alert(this.myVar);
}
WholsThis();*/