Home | Computer Science
 Write a programme using  prompt & parseInt;

<html>

<head><title>javascript</title>

<script>

var first=prompt("enter the first number");

var second=prompt("enter the second number");

first=parseInt(first);

second=parseInt(second);

if(first==second)

document.write("both numbers are equal");

else if(first>second)

document.write("first number is greater than second number");

else if(first<second)

document.write("second number is greater than first number");

else

document.write("error not valid inputs");

</script>

</head>

<body>

</body>

</html>

          

output is not valid in this program you can check output by copying this coding to notepad and run the program.

 Write a programme using prompt & parseInt;

<html>

<head><title>javascript</title>

<script>

var name=prompt("enter your name");

var name2=prompt("enter your father's name");

var marks=prompt("enter the marks of english");

var marks2=prompt("enter the marks of maths");

var marks3=prompt("enter the marks of science");

marks=parseInt(marks);

marks2=parseInt(marks2);

marks3=parseInt(marks3);

var total=marks+marks2+marks3;

var average=total/3;

var per=(total/300)*100;

document.write("<table><tr><th>Student's name</th><th>"+name+"</th></tr><tr><th>Father's name</th><th>"+name2+"</th></tr><tr><th>Total marks</th><th>"+total+"</th></tr<tr><th>Average</th><th>"+average+"</th></tr><tr><th>Percentage</th><th>"+per+"</th></tr></table>");

</script>

</head>

<body>

</body>

</html>

OUTPUT

output is not valid in this program you can check output by copying this coding to notepad and run the program.