fork download
  1. #include<stdio.h>
  2. void main()
  3. {
  4. int a,n,sum=0;
  5. printf("\nEnter the value of n= ");
  6. scanf("%d",&n);
  7. while(n!=0){
  8. a=n%10;
  9. n=n/10;
  10. sum=sum+a;
  11. }
  12. printf("\nSummation of the digit of your given number is=%d\n",sum);
  13.  
  14. }
  15.  
Runtime error #stdin #stdout 0s 2172KB
stdin
Standard input is empty
stdout
Enter the value of n= 
Summation of the digit of your given number is=24