JavaScript Decision Making
JavaScript Decision Making
Q1.Find Grades
Your school has the following grading system based upon the marks (M) obtained by a student:
If M≤10, the grade will be E.
If 11≥M≤20, the grade will be D.
If 21≥M≤30, the grade will be C.
If 31≥M≤40, the grade will be B.
If 41≥M≤50, the grade will be A.
Your friend will enter his marks out of 5050, and your task is to print his grades using a switch statement.
Note: You have to complete findGrades function. No need to take any input.
Input Format
The first and the only line of the input contain an integer M, representing the marks that your friend will enter in the grading system.
Output Format
Constraints
0≤M≤50
Example
Sample Input
1
Sample Output
E
You are provided with a table containing some characters and their corresponding values. Your task will be to find the value from the
table corresponding to an input character and return it.
| P or p - PrepBytes |
| Z or z - Zenith |
| E or e - Expert Coder |
| D or d - Data Structure |
Note: You have to complete getValue function. No need to take any input.
Input Format
The first and the only line of the input contain a character C, representing the character that you will get in input.
Output Format
Constraints
Example
Sample Input
E
Sample Output
Expert Coder
Take three numbers and print the largest number among them if all of three are same print −1−1.
Note: You have to complete Max_out_of_three. No need to take any input.
Input Format
Output Format
Constraints
1≤A, B, C≤10000
Example
Sample Input
254
Sample Output
5
You are given 33 distinct integers X, Y and Z and your task is to find and return the second smallest integer among the three provided
integers.
Note: You have to complete findSndSmallest function. No need to take any input.
Input Format
The first and the only line of the input contains three space-separated integers X, Y, and Z, denoting the integers among which you
have to find the second smallest element.
Output Format
Return the second smallest integer among the three integers given to you.
Constraints
1≤X, Y, Z≤500
X! =Y! =, Y!=Z!=, X!=Z
Example
Sample Input
2 9 23
Sample Output
9
Q5. Check whether the triangle is Acute or Obtuse
Write a program takes takes three angles and checks whether the triangle is acute or obtuse.
Note: You have to complete Triangle_Check. No need to take any input
Input Format
The input contains three numbers A, B and C which denotes the angles of a triangle.
Output Format
Constraints
0≤A, B, C≤180
Example
Sample Input
60 100 20
Sample Output
obtuse