Problem è Print the factorial and sum of factors of inputted number.

 

Answer è       

/* wap to know the factorial and sum of factorial of inputted number*/

#include <stdio.h>

main( )

{

int a,i,c,d,n;

clrscr( );

printf("\nHow many time you will like to run the program");

scanf ("%d", &n);

for(i=0;i<n;++i)

{

c=d=1;

printf ("\nenter the number - ");

scanf ("%d", &a);

for (c=1; c<=a;++c)

d=c*d;

printf ("\nfactorial of %d is %d", a, d);

c=d=0;

for (c=0; c<=a;++c)

d=c+d;

printf ("\nsum of factor of %d is %d", a, d);

}

getch( );

return 0;

}