Advertisement
Guest User

Crncuga

a guest
Dec 10th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.52 KB | None | 0 0
  1. int a;
  2. printf("unesi neki broj");
  3. scanf("%d", &a);
  4. if(a<0)
  5. printf("apsolutna vrednost broja %d je %d", a, -a);
  6. else
  7. printf("apsolutna vrednost broja %d je %d",a,a);
  8.  
  9.  
  10.  
  11. int a;
  12. int desetice, jedinice, stotine, sum=0;
  13. printf("unesi broj");
  14. if(a<0)
  15. printf("%d je negativan",a);
  16. else { int pom=a;
  17. jedinice=pom%10;
  18. pom=/=10
  19. desetice=pom%10
  20. pom/=10
  21. stotine=pom%10
  22. suma = desetice+jedinice+stotine
  23. printf("broj %d ima %d stotine %d desetice i %d jedinice", a,stotine,jedinice,desetice);
  24. printf("suma je %d",suma)
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement