Guest User

Untitled

a guest
Dec 11th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int b=0;
  8. string reshte ;
  9. cin >> reshte ;
  10.  
  11.  
  12. for(int i=0;i< reshte.size() ;i++)
  13. {
  14. if(!((reshte[i]>='0')&&(reshte[i]<='9')))
  15. {
  16. b=1;
  17. }
  18. }
  19. if(b==0)
  20. {
  21. int s=0;
  22. for(int i=0;i<reshte.size();i++)
  23. {
  24. s=s*10+(reshte[i]-'0');
  25. }
  26. cout<<s;
  27. }
  28. else
  29. {
  30. cout<<"error";
  31. }
  32. return 0;
  33. }
Add Comment
Please, Sign In to add comment