Ask your own question, for FREE!
Computer Science 10 Online
OpenStudy (anonymous):

make a function that will compute the product of digits of a number inputted by the user. C Language :D

OpenStudy (arnavguddu):

int calc(int n) { int digit, pr=1; if(n<0) n *= -1; while(n>=10) { digit = n%10; n /= 10; pr *= digit; } pr *= n; return pr; } try this and tell me

OpenStudy (anonymous):

hold on. i'll try to run. :D

OpenStudy (arnavguddu):

here is the code... run this code

OpenStudy (anonymous):

should i use Turbo C in compiling the code?

OpenStudy (arnavguddu):

ok

OpenStudy (anonymous):

okay. hold on. :)

OpenStudy (arnavguddu):

it works on any c c++ compiler

OpenStudy (anonymous):

yay. it's working! thank you so much! :)

OpenStudy (arnavguddu):

u r welcome

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!