Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- int main ( )
- {
- int y = 7632;
- int x = 1;
- cout << "Digit " << x << "of " << y << "is : ";
- int dig;
- dig = ((y - (y % (int)pow(10, x))) / (int)pow(10, x)) % (int)pow(10, x);
- cout << dig << "\n";
- return 0;
- }
- // Digit 1of 7632is : 3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement