Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int digit=0,x,number,x1;
- bool check=true;
- cin>>x;
- while ( check)
- {
- x1=x;
- x1=x1/10;
- digit++;
- if (x1==0)
- check=false;
- }
- cout <<"Numbers of Digits is "<<digit<<endl;
- cout <<"enter the number of the digit you want "<<endl;
- cin>>number;
- for (int i=0;i<number;i++)
- {
- x=x/10;
- }
- cout <<" "<<x<<" "<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement