forked from yoyoman21/Javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssignment12B(switch case).html
More file actions
44 lines (43 loc) · 1.25 KB
/
Assignment12B(switch case).html
File metadata and controls
44 lines (43 loc) · 1.25 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
<html>
<head>
<title>Javascript</title>
<h1>Assignment12B</h1>
</head>
<body bgcolor="yellow">
<script>
document.write("Open console box of windows for output");
var marks=prompt("enter the marks");
console.log(marks);
var ch;
ch=prompt("enter the choice");
// console.log(ch);
switch (ch)
{
case 'A' :if(marks>50 && marks<=60)
{
console.log("Marks are "+marks+" and grade is A");
}
break;
case 'B':
if(marks>40 && marks<=50)
{
console.log("Marks are "+marks+" and grade is B");
}
break;
case 'C':
if(marks>30 && marks<=40)
{
console.log("Marks are "+marks+" and grade is C");
}
break;
case 'D':
if(marks>20 && marks<=30)
{
console.log("Marks are "+marks+" and grade is D");
}
break;
default:console.log("Fail");
}
</script>
</body>
</html>