Advertisement
Guest User

numers

a guest
Jun 23rd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int digit=0,x,number,x1;
  8.     bool check=true;
  9.     cin>>x;
  10. while  ( check)
  11. {
  12.     x1=x;
  13.     x1=x1/10;
  14.     digit++;
  15.     if (x1==0)
  16.         check=false;
  17.  
  18. }
  19. cout <<"Numbers of Digits is "<<digit<<endl;
  20. cout <<"enter the number of the digit you want "<<endl;
  21. cin>>number;
  22. for (int i=0;i<number;i++)
  23. {
  24.     x=x/10;
  25. }
  26. cout <<"       "<<x<<"        "<<endl;
  27.  
  28.   return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement