Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Why static variable is used in c?

1046


What are data structures in c and how to use them?

1183


What is the size of enum in bytes?

1094


What are pointers?

1126


Explain what math functions are available for integers? For floating point?

1125


What are the different types of control structures in programming?

1144


Why do we need volatile in c?

1189


Write a program to generate a pulse width frequency of your choise,which can be variable by using the digital port of your processor

3553


What should malloc() do? Return a null pointer or a pointer to 0 bytes?

1087


Why is not a pointer null after calling free?

1033


What does the characters “r” and “w” mean when writing programs that will make use of files?

1488


pgm to find number of words starting with capital letters in a file(additional memory usage not allowed)(if a word starting with capital also next letter in word is capital cann't be counted twice)

2349


define string ?

1119


Does free set pointer to null?

1023


Can you apply link and association interchangeably?

1134