Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need help on this assignment *It will be a console based application Your assignment is to create a program in node.js named hw3.js that can

need help on this assignment

*It will be a console based application

Your assignment is to create a program in node.js named hw3.js that can do the following operations. You need to install 'readline-sync' you can install it using npm install

  1. Take four integer numbers as input from the console using 'readline-sync' like given example code. So, the user should be given a prompt for entering all 4 numbers one by one then need to press enter for getting the output. (5 points)

  2. Calculate the factorial of the first number. In the console, the factorial of that first given number should be shown as an output. (5 points)

  3. Calculate the sum of all the digits of the second number. For example, if we have the number 1234, the program will calculate 1+2+3+4 which is equal to 10. (5 points)

  4. For the third number given as an input, show the reversed number as an output. For instance, if we give 12345 as input, it will show 54321 as output (5 points)

  5. For the fourth number given as an input, check whether that number is a Palindrome or not and show the output as True in case it is a palindrome and False if it is not a palindrome. For example, if we give 12345 as an input it will return false but if we give 12321 as input, it will return true. (5 points)

    Sample Input and Output:

  6. image text in transcribed

C: \Users shibbir\Documents TA NodeJSPortable\Data>node hw3.js 1st Number: 5 2nd Number: 1234 3rd Number: 1234567 4th Number: 12321 Factorial of the 1st number is 120 The Sum of all the digits of the 2nd number10 The Reverse of the 3rd number is - 7654321 Is the 4th Number a Palindrome(True/False)?true

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

4th Edition

0805360476, 978-0805360479

Students also viewed these Databases questions