P. 1
C program to calculate the sum of digits in 100 factorial

C program to calculate the sum of digits in 100 factorial

|Views: 114|Likes:
Published by Vikas

More info:

Published by: Vikas on Aug 01, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

08/01/2012

pdf

text

original

Sum of digits in 100 factorial.

#include <stdio.h>
main() {
unsigned int dig[200], first = 0, last = 0, carry, n, , sum = 0!
dig[0] = "!
for (n = 2! n <= ##! n$$) {
carry = 0!
for ( = first! <= last! $$) {
carry = dig[]%n $ carry!
dig[] = carry & "000!
if ( == first '' ((carry & "000))
first$$!
carry )= "000!
*
if (carry)
dig[$$last] = carry!
*
for ( = first! <= last! $$) {
sum $= dig[]&"0 $ (dig[])"0)&"0 $ (dig[])"00)&"0!
*
+rintf(,-um. &d/n,, sum)!
*

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->