fork download
  1. #include <stdio.h>
  2.  
  3. int main () {
  4. int a, b, numa, numb, res;
  5. char op;
  6. scanf("%c %c %c", &a, &op, &b);
  7. if(a >= 97) numa = a - 96;
  8. else numa = a - 38;
  9. if(b >= 97) numb = b - 96;
  10. else numb = b - 38;
  11. if(op == '+') res = numa + numb;
  12. else if (op == '-') res = numa - numb;
  13. else if (op == '*') res = numa * numb;
  14. else if (op == '/') res = numa / numb;
  15. else if (op == '%') res = numa % numb;
  16. if(res >= 53) res = res - (res / 52) * 52;
  17. if(res <= 0) res+=52;
  18. if(res <= 26) printf("%c", res+96);
  19. else printf("%c", res+38);
  20. return 0;
  21. }
  22. //In this code, a-z is denoted as 1-26 and A-Z as 27-52
  23. //Arithmetic operations are applied using this number system
  24. //If the result goes lower than 1, it goes back to 52 (Z)
  25. //If the result goes higher than 52, it goes back to 1 (a)
  26.  
Success #stdin #stdout 0s 5288KB
stdin
Standard input is empty
stdout
Z