DevJourney · code I wrote while learning

README.md

1019 B

Factorial and its sum of digits

Single File Programming Question

Problem Statement

Alice is studying mathematics, and she's interested in calculating the factorial of a number and finding the sum of the digits of the factorial. To help her with this, you create a Factorial class that can perform both tasks using classes and objects.

Input:

format :

The first line of input contains the integer 'n'.

Output:

format :

The first line of the output should print the factorial of 'n' and the second line should print the sum of its digits in the following format:

"Factorial of <n> is: <factorial>

Sum of its digits is: <sum>"

Refer to the sample output for format specifications

Code constraints : The given test cases fall under the following constraints:

0 ≤ n ≤ 100

Sample test cases :

Input 1:

5
Output 1 :
Factorial of 5 is: 120
Sum of its digits is: 3
Input 2 :
25
Output 2 :
Factorial of 25 is: 15511210043330985984000000
Sum of its digits is: 72