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

Assignment1 JavaScript

Uploaded by

Ahmed Smaha
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)
23 views

Assignment1 JavaScript

Uploaded by

Ahmed Smaha
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/ 5

Assignment 1

1- Write a program that allow to user enter number then print it

Example
Input: 5
Output: 5

2- Write a program that take number from user then print yes if that number can divide by 3
and 4 otherwise print no
Example1
Input: 12 Output Yes
Example 2
Input: 9 Output No

3- Write a program that allows the user to insert 2 integers then print the max
Example1
Input: 3 5
Output: 5
Example 2
Input: 10 7
Output: 10

4- Write a program that allows the user to insert an integer then print negative if it is
negative number otherwise print positive.
Example 1
Input: -5
Output negative
Example2
Input: 10
Output positive
5- Write a program that take 3 integers from user then print the max element
and the min element.
Example 1
Input:7,8,5
Output:
max element = 8
min element = 5

Example2
Input: 3 6 9
Outputs:
Max element = 9
Min element = 3

6- Write a program that allows the user to insert integer number then
check If a number is oven or odd
Example 1
Input: 8
Output: even
Example 2
Input: 7
Output: odd

7- Write a program that take character from user then if it is vowel chars (a,e,I,o,u)
then print vowel otherwise print consonant
Example1
Input: O
Output: vowel
Example 2
Input: b
Output:
Consonant

8- Write a program that allows user to insert integer then print all numbers between 1 to
that’s number
Example Input 5
Output 1, 2, 3, 4, 5
9- Write a program that allows user to insert integer then print a multiplication table up to 12.
Example
Input: 5
Outputs:
5 10 15 20 25 30 35 40 45 50 55 60

10- Write a program that allows to user to insert number then print all even numbers
between 1 to this number
Example:
Input: 15

Output: 2 4 6 8 10 12 14

11- Write a program that take two integers then print the power

Example:
Input: 4 3
Output: 64
Hint how to calculate 4^3 = 4 * 4 * 4 =64

12- Write a program to enter marks of five subjects and calculate total, average and
percentage.

Example
Input: - Enter Marks of five subjects:

95
76
58
90
89

Output:-.Total marks = 435


Average Marks =87
Percentage =87
12- Write a program to input month number and print number of days in that
month.
Example:
Input: - Month Number: 1
Output:-. Days in Month: 31

13- Write a program that calculates the factorial of a given integer.


Example:
Input: 5
Output: 120

14- (Bounce) Write a program to check if a given integer is an Armstrong number. An


Armstrong number for a given number of digits is an integer such that the sum of
its own digits each raised to the power of the number of digits gives the number
itself.
Example:
Input: 153
Output: Armstrong

15- Write a program that takes a string and returns the number of unique characters
in it.
Example:
Input: "hello"
Output: 4 (because h, e, l, o are unique)

16- Write a program to input marks of five subjects


Physics, Chemistry, Biology, Mathematics and Computer
, Find percentage and grade

Percentage >= 90%: Grad A


Percentage >= 80%: Grad B
Percentage >= 70%: Grad C
Percentage >= 60%: Grad D
Percentage >= 40%: Grad E
Percentage < 40%: Grad F
******************************** Using switch case*******************************
17- Write a program to print total number of days in month

18- Write a program to check whether an alphabet is vowel or consonant

19- Write a program to find maximum between two numbers

20- Write a program to check whether a number is even or odd

21- Write a program to check whether a number is positive or negative or zero

22- Write a program to create Simple Calculator

You might also like