Advertisement
LegoDrifter

Odeluvanje cifri i suma na tie cifri

Dec 20th, 2019
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.21 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6. int n,c1,broj=0,suma=0,z;
  7. scanf("%d",&n);
  8. while(n){
  9.     c1=n%10;
  10.     n/=10;
  11.     z=broj*10+c1;
  12.     suma+=z;
  13. }
  14.     printf("%d\n",suma);
  15.  
  16. return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement