Given a number N, product(N) is the product of the digits of
N. We can then form a sequence N, product(N),
product(product(N))… For example, using 99, we get the
sequence 99, 99 = 81, 81 = 8.

Input Format:
A single integer N

Output Format:

A single integer which is the number of steps after which a
single digit number occurs in the sequence.

Sample Test Cases:

Input #00:
99

Output #00:
2

Explanation:
Step - 1 : 9 * 9 = 81
Step - 2 : 8 * 1 = 8
There are 2 steps to get to this single digit number.

Input #01:
1137638147

Answer Posted / tuhin banerjee

#include<stdio.h>

int main()
{
int s,mul;
long num;
int count =0;
printf("enter the no:");
scanf("%ld",&num);
mul=num;
while(mul>10)
{
mul=1;
while(num!=0)
{
s=num%10;
mul=mul*s;
num=num/10;
}
num=mul;
count++;
}
printf("the single digit sum is :%d",mul);
printf("the single digit answer is :%d",count);
return 0;
}

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2

1533


A function can make the value of a variable available to another by a) declaring the variable as global variable b) Passing the variable as a parameter to the second function c) Either of the two methods in (A) and (B) d) binary stream

671


What is difference between structure and union with example?

601


1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. 2) the Event Manager has to send participants to the stage to perform in the order in which they registered. Write a program that will help the Event Manager know who to call to the stage to perform. The Logic should be in Data Structures

2747


Do you know the purpose of 'register' keyword?

646






Explain what is the most efficient way to store flag values?

702


What are qualifiers?

619


What is else if ladder?

614


The postoder traversal is 7,14,3,55,22,5,17 Then ur Inorder traversal is??? please help me on this

2940


What are the modifiers available in c programming language?

744


A set of N billiard balls are set on a one-dimensional table. The table is 1 meter long, set north-south with two pockets at either side. Each ball has zero width and there is no friction so it is moving with a fixed velocity of either northward or southward and bounces back in a perfect elastic collision from other balls it encounter on its way (or drop into one of the pockets). Your job is to keep track of the balls movements. Task Please write a program that gets the initial place, speed and direction of all the balls and gives the position of a specific ball after t seconds. Input The first line contains the number of scenarios. Each one of the other lines in the input contains a scenario: The first number, N, is the number of balls; followed by N pairs of numbers: the distance in centimeters from the south end of the table and the speed (positive speed meaning it moves northward); the last two numbers are the number i of the target ball you should track and the time T in seconds. Output The output is a single number for each line which is the place (distance in centimeters from the south end of the table) of the tracked ball after T seconds. Note: There is no new line character at the end of the result. Sample Input 5 1 50 1 1 1000 1 50 1 1 6 1 60 -2 1 6 2 10 1 95 -1 2 30 2 10 1 95 -1 2 60 Sample Output 100 56 48 65 70

2137


What are pointers?

636


Can we declare variables anywhere in c?

582


Explain how can a program be made to print the name of a source file where an error occurs?

693


Write a program to print factorial of given number using recursion?

607