fork download
  1. //bismillahir rahmanir rahim
  2. ///rabiulrafi01@gmail.com
  3. ///jessore university of science & technology
  4. //__________________________//
  5.  
  6. #include<stdio.h>
  7. #include<string.h>
  8. int main()
  9. {
  10. char num[105],last_char;
  11. int i,j,sum,l,k,last_num­,sum1,sum2,r,r1,ck;
  12. while(scanf("%s",num­)==1)
  13. {
  14. if(strcmp(num,"0")==­0)
  15. {
  16. break;
  17. }
  18. sum=0;
  19. ck=0;
  20. l=strlen(num);
  21.  
  22. for(i=1;i<=l;i++)
  23. {
  24. last_char=num[l-i];
  25. last_num=last_char-'­0';
  26. sum=sum+last_num;
  27. }
  28.  
  29.  
  30. sum1=0;
  31. while(sum!=0)
  32. {
  33. r=sum%10;
  34. sum1=sum1+r;
  35. sum=sum/10;
  36. }
  37. if(sum1>=10)
  38. {
  39. sum2=0;
  40. while(sum1!=0)
  41. {
  42. r1=sum1%10;
  43. sum2=sum2+r1;
  44. sum1=sum1/10;
  45. ck=1;
  46. }
  47. }
  48. if(ck==1){
  49. printf("%d\n",sum2);
  50. }
  51. else
  52. printf("%d\n",sum1);
  53.  
  54.  
  55.  
  56. }
  57. return 0;
  58. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
12345
compilation info
prog.m: In function ‘main’:
prog.m:11:25: error: stray ‘\302’ in program
 int i,j,sum,l,k,last_num­,sum1,sum2,r,r1,ck;
                         ^
prog.m:11:26: error: stray ‘\255’ in program
 int i,j,sum,l,k,last_num­,sum1,sum2,r,r1,ck;
                          ^
prog.m:12:21: error: stray ‘\302’ in program
 while(scanf("%s",num­)==1)
                     ^
prog.m:12:22: error: stray ‘\255’ in program
 while(scanf("%s",num­)==1)
                      ^
prog.m:14:21: error: stray ‘\302’ in program
 if(strcmp(num,"0")==­0)
                     ^
prog.m:14:22: error: stray ‘\255’ in program
 if(strcmp(num,"0")==­0)
                      ^
prog.m:25:20: warning: multi-character character constant [-Wmultichar]
 last_num=last_char-'­0';
                    ^~~~~
prog.m:11:15: warning: unused variable ‘k’ [-Wunused-variable]
 int i,j,sum,l,k,last_num­,sum1,sum2,r,r1,ck;
               ^
prog.m:11:7: warning: unused variable ‘j’ [-Wunused-variable]
 int i,j,sum,l,k,last_num­,sum1,sum2,r,r1,ck;
       ^
stdout

Standard output is empty