Advertisement
kostes

Untitled

Mar 12th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. setlocale(0,"");
  9. string st;
  10. cout<<"введи строку - St"<<endl;
  11. getline(cin, st);
  12. int n = st.length();
  13. int k = n;
  14. bool lstChetn = 0;
  15. for (int i = 0; i < n; i++)
  16. {
  17. if(st[i]<'0'||st[i]>'9') continue;
  18. if(((st[i]-'0')%2)==0)lstChetn=1;
  19. else lstChetn=0;
  20. }
  21. if(lstChetn) cout<<"Chetnoje";
  22. else cout << "Nechetnoje";
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement