Knowee
Questions
Features
Study Tools

Find whether the given number is strong number or not. The sum of factorial of each digit, is equal to the original number.Input Format:Accept a Integer an input  Output Format:Print "Strong Number" or "Not a strong number"

Question

Find whether the given number is strong number or not. The sum of factorial of each digit, is equal to the original number.Input Format:Accept a Integer an input  Output Format:Print "Strong Number" or "Not a strong number"

🧐 Not the exact question you are looking for?Go ask a question

Solution

Sure, here is a step by step solution to find whether a given number is a strong number or not.

Step 1: First, we need to understand what a strong number is. A strong number is a number in which the sum of the factorial of its digits is equal to the number itself.

Step 2: Let's take an example, say the number is 145. We need to find the factorial of each digit and then add them.

Step 3: The factorial of a number is the product of all positive integers less than or equal to that number. For example, the factorial of 4 is 432*1 = 24.

Step 4: Now, find the factorial of each digit in the number 145. The factorial of 1 is 1, the factorial of 4 is 24, and the factorial of 5 is 120.

Step 5: Add these factorials together. 1 + 24 + 120 = 145.

Step 6: Compare this sum with the original number. If they are the same, then the number is a strong number. In this case, 145 is a strong number because the sum of the factorials of its digits is equal to the number itself.

Step 7: If the sum is not equal to the original number, then it is not a strong number.

So, the output for the number 145 would be "Strong Number". If the number was something else where the sum of the factorials of its digits did not equal the number itself, the output would be "Not a strong number".

This problem has been solved

Similar Questions

Problem StatementBethany is supposed to determine a number's strength is determined by the sum of factorials of its digits. Create a program for her that takes a long integer as input and validates if the given number code is a strong number or not.If the sum of factorials is equal to the original number, the output must print "Strong number"; otherwise, it prints "Not a strong number."Input format :The input consists long integer n, representing the number.Output format :The output prints "Strong number" if the given number is strong, otherwise it prints "Not a strong number".Refer to the sample output for formatting specifications.Code constraints :In this scenario, the given test cases fall under the following constraints:1 ≤ n ≤ 50000Sample test cases :Input 1 :1Output 1 :Strong numberInput 2 :45361Output 2 :Not a strong numberInput 3 :5656Output 3 :Not a strong numbe

Bethany is supposed to determine a number's strength is determined by the sum of factorials of its digits. Create a program for her that takes a long integer as input and validates if the given number code is a strong number or not.If the sum of factorials is equal to the original number, the output must print "Strong number"; otherwise, it prints "Not a strong number."Input format :The input consists long integer n, representing the number.Output format :The output prints "Strong number" if the given number is strong, otherwise it prints "Not a strong number"

You are provided with the pseudocode for the below problem statement and it is shuffled.Rearrange the same so that it will be the correct pseudocode.Problem Statement :Strong numberCheck if a given number is a strong number. 145 is a strong number because 1!+4!+5! = 145. Write an algorithm, a flowchart and a pseudo code for the same.Sample Input :145Sample Output :Strong numberBEGINDECLARE variables number, sum, temp, remainder, factREAD numberSET sum=0, temp=numberWHILE number != 0SET fact = 1FOR i IN 1 to remainder DOremainder = number % 10END FOREND IFIF sum==temp THENPRINT "Strong number"fact = fact *iPRINT "Not a Strong number"ELSEsum = sum+ factnumber = number / 10END WHILEEND

Write a Python program using a while loop to calculate and display the factorial of a user-inputnumber. Ensure your program handles invalid inputs gracefully.

Write a python function to find the factorial of given number

1/1

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.