Advertisement
Guest User

Untitled

a guest
Aug 12th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4.  
  5. int main ( )
  6. {
  7.     int y = 7632;
  8.     int x = 1;
  9.     cout << "Digit " << x << "of " << y << "is : ";
  10.     int dig;
  11.     dig = ((y - (y % (int)pow(10, x))) / (int)pow(10, x)) % (int)pow(10, x);
  12.     cout << dig << "\n";
  13.     return 0;
  14. }
  15.  
  16. // Digit 1of 7632is : 3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement