0% found this document useful (0 votes)
2 views2 pages

Exc for Javascript Function, Operator and Conditional

The document outlines four JavaScript programming tasks: a Grade Calculator that assigns grades based on scores, an Even or Odd Checker to determine the parity of a number, a Simple Calculator for basic arithmetic operations, and a program to find the largest of three numbers. Each task specifies the use of functions, conditional statements, and relevant operators. The instructions emphasize variable declaration, initialization, and appropriate logic to achieve the desired outcomes.

Uploaded by

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

Exc for Javascript Function, Operator and Conditional

The document outlines four JavaScript programming tasks: a Grade Calculator that assigns grades based on scores, an Even or Odd Checker to determine the parity of a number, a Simple Calculator for basic arithmetic operations, and a program to find the largest of three numbers. Each task specifies the use of functions, conditional statements, and relevant operators. The instructions emphasize variable declaration, initialization, and appropriate logic to achieve the desired outcomes.

Uploaded by

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

1.

Grade Calculator

Write a JavaScript program that takes a student's score (out of 100) as input and
determines their grade based on the following conditions:

 90 and above → "Grade: A"


 80 to 89 → "Grade: B"
 70 to 79 → "Grade: C"
 60 to 69 → "Grade: D"
 Below 60 → "Grade: F"
 Use a function calculateGrade(score) to determine the grade.
 Declare and initialize a variable to store the input score.
 Use comparison operators (>=, <) and conditional statements (if-else).

2, Even or Odd Checker

Write a JavaScript program that takes a number as input and checks whether it is even or
odd.

 Declare and initialize a variable for the input number.


 Use a function checkEvenOdd(num) to determine if the number is even or odd.
 Use the modulus operator % to check divisibility by 2.
 Print "Even Number" if divisible by 2, otherwise print "Odd Number".

3. Simple Calculator

Write a JavaScript program that takes two numbers and an operator (+, -, *, /) as input,
then performs the corresponding operation.

 Declare and initialize three variables: two numbers and an operator.


 Use a function calculate(num1, num2, operator) that:
o Adds the numbers if the operator is "+"
o Subtracts the numbers if the operator is "-"
o Multiplies the numbers if the operator is "*"
o Divides the numbers if the operator is "/"
o Displays "Invalid operator" for any other input
 Use conditional statements (if-else).
 Use arithmetic operators (+, -, *, /).
4. Find the Largest Number

Write a JavaScript program that takes three numbers and determines the largest one.

 Declare and initialize three variables for the input numbers.


 Use a function findLargest(num1, num2, num3).
 Use comparison operators (>) and conditional statements (if-else).
 Print the largest number.

You might also like