Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html xmlns = "http://www.w3.org/1999/xhtml">
- <head>
- <title>Analysis of Examination Results</title>
- <script type = "text/javascript">
- <!--
- // initializing variables in declarations
- var passes = 0, // number of passes
- failures = 0, // number of failures
- student = 1, // student counter
- result; // one exam result
- // process 10 students; counter-controlled loop
- while ( student <= 10 ) {
- result = window.prompt(
- "Enter result (1=pass,2=fail)", "0" );
- if ( result == "1" )
- passes = passes + 1;
- else
- failures = failures + 1;
- student = student + 1;
- }
- // termination phase
- document.writeln( "<h1>Examination Results</h1>" );
- document.writeln(
- "Passed: " + passes + "<br />Failed: " + failures );
- if ( passes > 8 )
- document.writeln( "<br />Raise Tuition" );
- // -->
- </script>
- </head>
- <body>
- <p>Click Refresh (or Reload) to run the script again</p>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement