MilanR

Untitled

Mar 20th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.30 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <math.h>
  3.  
  4. void main()
  5. {
  6.     int n, k,BC = 0;
  7.     n = 12345;
  8.     k = 2;
  9.  
  10.     int pom = n;
  11.     while (pom > 0)
  12.     {
  13.         BC++;
  14.         pom /= 10;
  15.     }
  16.  
  17.     for (int i = 1; i <= k; i++)
  18.     {
  19.         pom = n % 10;
  20.         n /= 10;
  21.         n += pom*pow(10.0, BC-1);
  22.     }
  23.     printf("12345 za 2 mesta u desno je %d", n);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment