​Task 4-Exchange of digits-solution

#include < stdio.h >
using namespace std;
int main()
{
  int n,b,j,s,os,d;
  scanf("%d",&n); // Entering a natural number, e.g. n = 2349
  j=n%10; // the rest of division n and 10, j = n% 10 = 9
  os=n%1000; // the remainder of division n with 1000, os = n% 1000 = 349
  d=os%100/10; // extracts the digit of ten, d = (349% 100) / 10
// d = 49/10 = 4
  s=os/100; // extract the digit of the hundred, s = 349/100 = 3
  b=n-os; // The number is transformed, b = 2349-349 = 2000
  b=b+j*100+d*10+s; // Replacement of hundreds and units,
 // b = 2000 + 9 * 100 + 4 * 10 + 3 = 2943
  printf("%d",b); // print b
  return 0;
}