Exercise

  1. Write a code segment which prompts the user for their name, and then displays a special greeting to that person if their name is the same as yours. If the name entered by the user is anything other than your name, your code should not produce any output.

  2. Write a JavaScript conditional statement to find the largest of five numbers. Display an alert box to show the result.

  3. We ask our user to enter grades of three disciplines and calculate the sum and the average. Now we want to do one more thing :

    1. If the average grade is higher than or equal to 85, print “Excellent!”
    2. if between 75 and 84, print “Good!”;
    3. otherwise, print “Work harder!”

Bonus Challenge :

  1. Write a JavaScript program which iterates the integers from 1 to 50. But for multiples of 3 print "Fizz" instead of the number and for the multiples of 5 print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz". Note : use remainder/modulus sign (%).

results matching ""

    No results matching ""