0% found this document useful (0 votes)
59 views5 pages

Assignment Number: 7 Roll Number: 38

This document contains 4 programming questions and answers. Question 1 asks to write a program to determine if a number is even or odd. Question 2 asks to find the largest of 3 numbers entered. Question 3 asks to calculate student percentage and display information. Question 4 asks to perform arithmetic operations like addition, subtraction etc. using switch case. For each question, the source code and output is provided.

Uploaded by

Tasleem Shaikh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views5 pages

Assignment Number: 7 Roll Number: 38

This document contains 4 programming questions and answers. Question 1 asks to write a program to determine if a number is even or odd. Question 2 asks to find the largest of 3 numbers entered. Question 3 asks to calculate student percentage and display information. Question 4 asks to perform arithmetic operations like addition, subtraction etc. using switch case. For each question, the source code and output is provided.

Uploaded by

Tasleem Shaikh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Assignment Number: 7 Roll Number: 38

QUESTION NUMBER 1:-Write a program to determine whether entered number is


even or odd.

SOURCE CODE:-

<Html>
<head>
<title>Assignment Number 7 Q1</title>
</head>
<body>
<Script Language="Javascript">
var num1=prompt("Enter Any Number");
if(num1%2==0)
alert("The Number Is Even");
if(num1%2!=0)
alert("The Number Is Odd");
</script>
</Body>
</html>
OUTPUT:-

Page Number:-
Assignment Number: 7 Roll Number: 38
QUESTION NUMBER 2:- Write A program to find out largest number by entering 3
number.

SOURCE CODE:-
<html>
<head>
<title>Largest Number</title>
</head>
<body>
<script language="javaScript">
var a=prompt("Enter First Number");
var b=prompt("Enter Second Number");
var n1=parseInt(a);
var n2=parseInt(b);
if(n1>n2)
document.write("First Number Is Largest");
else
document.write("Second Number Is Largest");
</script>
</body>
</html>
OUTPUT:-

Page Number:-
Assignment Number: 7 Roll Number: 38

QUESTION NUMBER 3:- Write program to calculate the percentage of student display
the grade and related statements. (Roll No., Name, Class Name, Marks of 5 subjects,
Total, Percentage).

SOURCE CODE:-
<html>
<head>
<title>student_info</title>
</head>
<body>
<script language="javascript">
document.write("Student Information");
var a=prompt("Enter name:");
var roll=prompt("Enter roll no:");
var classnm=prompt("Enter class name:");
var m1=prompt("Enter mark of C++:");
var m2=prompt("Enter mark of Web:");
var m3=prompt("Enter mark of DBMS:");
var m4=prompt("Enter mark of ED:");
var m5=prompt("Enter mark of OB:");
var total=parseInt(m1)+parseInt(m2)+parseInt(m3)+parseInt(m4)+parseInt(m5);
var avg=total/5;
document.write("<br> Roll NO:-"+roll);
document.write("<br> Name:-"+a);
document.write("<br> Class Name:-"+classnm);
document.write("<br> Mark of C++:"+m1);
document.write("<br> Mark of web:"+m2);
document.write("<br> Mark of ED:"+m3);
document.write("<br> Mark of OB:"+m4);
document.write("<br> Mark of DBMS:"+m5);
document.write("<br> Total Mark Of student:"+total);
document.write("<br> Average:"+avg);
</script>
</body>
</html>
Page Number:-
Assignment Number: 7 Roll Number: 38

OUTPUT:-

Page Number:-
Assignment Number: 7 Roll Number: 38
QUESTION NUMBER 4:-Write a program to calculate arithmetic operation using switch
case.

SOURCE CODE:-
<html>
<head>
<title>Switch Statement</title>
</head>
<body>
<script language="javascript">
var n1=prompt("Enter first number");
var n2=prompt("Enter second number");
var ch=parseInt(prompt("Enter your choice:1.Addition 2.Substraction 3.Multiplication
4.Division"));
switch(ch)
{
case 1: var n3=n1+n2;
document.write("<br>"+"Addition="+n3);
break;
case 2: var n4=n1-n2;
document.write("<br>"+"Substraction="+n4);
break;
case 3: var n5=n1*n2;
document.write("<br>"+" Multiplication="+n5);
break;
case 4:var n6=n1/n2;
document.write("<br>"+"Division="+n6);
break;
default:document.write("Enter correct choice");
break;
}
</script>
</body>
</html>
OUTPUT:-

Page Number:-

You might also like