fork(1) download
  1. #include<stdio.h>
  2.  
  3. int main (){
  4. int num;
  5. printf("welcome to word of factorial ");
  6. printf("\n please enter number: ");
  7. scanf("%d",&num);
  8. int sum=0;
  9.  
  10. while(num>0){
  11. sum+=num%10;
  12. num/=10;
  13.  
  14.  
  15. }
  16. printf("\n the factorial of %d is %d ",num,sum );
  17.  
  18. return 0;
  19. }
Success #stdin #stdout 0s 5276KB
stdin
Standard input is empty
stdout
welcome to word of factorial 
 please enter number: 
 the factorial of 0 is 22