csmahmud99 / js-problem-solving

In this repo, I have solved some junior-level real-life JavaScript problems.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

js-problem-solving

In this repo, I have solved some junior-level real-life JavaScript problems.

  • Problem - 01: (returnCalculation.js)

Harry's mom gave him money and asked him to buy some oranges and apples. Write a program to help Harry calculating how much money the shopkeeper will return.

➡️ Input: The first line of the input is the taka Harry's mom gave him. The second line is the cost of 1kg of oranges and 1kg of apples.

➡️ Output: Print the result.

✍🏽 Sample Input : 1000 || 700
✍🏽 Output : 300

  • Problem - 02: (averageMarks.js)

Write a program to calculate the average marks of Mathematics, Biology, Chemistry, Physics and Bangla of a student.

➡️ Input: The first line of the input is the marks if the five subjects mentioned above, respectively.

➡️ Output: Print the result in 2 decimal places.

✍🏽 Sample Input : 75.25, 65, 80, 35.45, 99.50
✍🏽 Output : 71.04

  • Problem - 03: (combineStrings.js)

John's teacher gave him two variables. Each variable contains a string. John's teacher asked him to combine these two strings and print them in one line. Help John to write the program.

➡️ Input: The first and the second lines of the input contain the strings.

➡️ Output: Print the result in one line.

✍🏽 Sample Input : I am going to be || an awesome web developer
✍🏽 Output : I am going to be an awesome web developer

  • Problem - 04: (findRemainder.js)

Sarah's mother is teaching her Mathematics. She gave Sarah a number and asked her what the remainder would be if she divided the number by 5. Help Sarah write the program.

➡️ Input: The first line of the input contains the number.

➡️ Output: Print the remainder.

✍🏽 Sample Input : 119
✍🏽 Output : 4

  • Problem - 05: (arrayPosition.js)

You are given an array:
var fruits = ["Apple", "Banana", "Orange"];

a) Find the index of 'Banana' and replace 'Banana' with 'Mango'.
b) Remove 'Orange' and add 'Watermelon'.

  • Problem - 06: (findGrades01.js)

You and your friends Tom, Jane, Peter and John got their final exam results. Your total score is 85, Tom's total score is 66, Jane's total score is 95, Peter's total score is 56 amd John's total score is 40.

The grading chart is -
➡️ 80 or above A grade,
➡️ 60 or above B grade,
➡️ 50 or above C grade,
➡️ 40 or above D grade and
➡️ 39 or above => F grade.

Write a program to find your and your friends' grades using 'if-else'.

  • Problem - 07: (findGrades02.js)

Find the grade of your achieved GPA or marks.

The grading chart is -
➡️ 0-32: 'F' Grade, ➡️ 33-49: 'D' Grade,
➡️ 50-59: 'C' Grade, ➡️ 60-69: 'B' Grade, ➡️ 70-79: 'A' Grade, ➡️ 80-100: 'A+' Grade.

  • Problem - 08: (largestNumber.js)

You are given three numbers 13, 79 and 45. Write a program that will print the largest number using 'if-else'.

  • Using Multi-stage 'if-else' Conditional: else...else if...else.

  • Using Nested 'if-else' Conditional.

  • Problem - 09: (isosceles.js)

You are given a triangle with the sides 9, 8, 9. Write a program to check whether the triangle is Isosceles or not using 'if-else'.

✍🏽 Isosceles => two sides are equal.

  • Problem - 10: (trafficSignal.js)

You are in a hurry to go to your school. But while you are trying to cross the road, you can see that the color of the traffic signal is red; in this situation, if you try to cross the road, it can be a danger for you. If the traffic signal's color is yellow, you should stop if you are trying to make an attempt to cross the road and wait. And if the color of the traffic signal is green, then you should try to cross the road.

Now, write a code with a variable named 'signal'; its value can be green, yellow, or red; and according to different colors, different tasks will be done.

  • Problem - 11: (nestedIfElse.js)

Check if the value of the variable named 'number' is 30 or, not; if it is 30, then check if its data type is 'string' or not. If it is '30' and 'string', then she output, otherwise show the text 'Nothing'.

  • Problem - 12: (evenOdd.js)

Find a given number is Even or, Odd.

About

In this repo, I have solved some junior-level real-life JavaScript problems.


Languages

Language:JavaScript 100.0%