0% found this document useful (0 votes)
26 views

Class Notes HTML CSS Chapters6-9

This document contains 7 math and JavaScript coding assignments. The assignments include: 1) Writing a program to display arithmetic results, 2) Explaining the output of a multi-step arithmetic expression, 3) Writing a program to greet a user by name, 4) Writing a program to display a multiplication table for a user-input number or default to 5, 5) Taking subject names and marks from a user and calculating totals and percentage, and 6) Additional assignments.

Uploaded by

Syed Shoaib
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Class Notes HTML CSS Chapters6-9

This document contains 7 math and JavaScript coding assignments. The assignments include: 1) Writing a program to display arithmetic results, 2) Explaining the output of a multi-step arithmetic expression, 3) Writing a program to greet a user by name, 4) Writing a program to display a multiplication table for a user-input number or default to 5, 5) Taking subject names and marks from a user and calculating totals and percentage, and 6) Additional assignments.

Uploaded by

Syed Shoaib
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

MATH EXPRESSIONS

Assignment # 6
JAVASCRIPT
ALERTS | JAVASCRIPT

1. Write a program to take a number in a variable, do the


required arithmetic to display the following result in your
browser:

2. What will be the output in variables a, b & result after


execution of the following script:
var a = 2, b = 1;
var result = --a - --b + ++b + b--;
Explain the output at each stage:
--a;
--a - --b;
--a - --b + ++b;
--a - --b + ++b + b--;

Page 1 of 3
ALERTS | JAVASCRIPT

3. Write a program that takes input a name from user &


greet the user.
4.
5. Write a program to take input a number from user &
display it’s multiplication table on your browser. If user
does not enter a new number, multiplication table of 5
should be displayed by default.

6. Take
a) Take three subjects name from user and store them in 3
different variables.
b) Total marks for each subject is 100, store it in another
variable.
c) Take obtained marks for first subject from user and
stored it in different variable.
Page 2 of 3
ALERTS | JAVASCRIPT

d) Take obtained marks for remaining 2 subjects from user


and store them in variables.
e) Now calculate total marks and percentage and show the
result in browser like this.(Hint: user table)

7.

Page 3 of 3

You might also like