fork download
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. int strToNumber(char *s) {
  6. int x = 0, i = 0;
  7. while (i < strlen(s)){
  8. x = x * 10 + int(s[i] % 10 - '0');
  9. ++i;
  10. }
  11. return (x * x);
  12. }
  13. int main() {
  14. char c[1001];
  15. cin.getline(c, 1001);
  16. cout << strToNumber(c);
  17. return 0;
  18. }
Success #stdin #stdout 0.01s 5256KB
stdin
11
stdout
184041