Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<time.h>
  4. void main()
  5. {
  6. char i;
  7. int a,k=0,b,n=1,f,v,e=0,r,g,j;
  8. printf("a=");
  9. scanf("%d",&a);
  10. printf("Sistema schislenia=");
  11. scanf("%d",&b);
  12. r=a/b;
  13. g=a%b;
  14. v=a/b;
  15. f=a%b;
  16. j=f*10;
  17. e=e+j;
  18. while (v)
  19. {
  20. f=v%b;
  21. v=v/b;
  22. j=f;
  23. while (k<=n-1)
  24. {
  25. j=j*10;
  26. k=k+1;
  27. }
  28. e=e+j;
  29. k=0;
  30. n=n+1;
  31. }
  32. if (b>=11) r=r; else {
  33. r=0;
  34. printf("%d",e);
  35. }
  36. while (r)
  37. {
  38. printf("%d%d",r,g);
  39. g=r%b;
  40. r=r/b;
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement