Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int b=0;
- string reshte ;
- cin >> reshte ;
- for(int i=0;i< reshte.size() ;i++)
- {
- if(!((reshte[i]>='0')&&(reshte[i]<='9')))
- {
- b=1;
- }
- }
- if(b==0)
- {
- int s=0;
- for(int i=0;i<reshte.size();i++)
- {
- s=s*10+(reshte[i]-'0');
- }
- cout<<s;
- }
- else
- {
- cout<<"error";
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment