fork download
  1. #include <stdio.h>
  2.  
  3. void myToUpper(char s[]) {
  4. int i;
  5. for (i = 0; s[i] != '\0'; i++) {
  6. if ('a' <= s[i] && s[i] <= 'z') { // Corrected condition
  7. s[i] = s[i] - 32; // Converts lowercase to uppercase
  8. }
  9. }
  10. }
  11.  
  12. int main() {
  13. char s[100];
  14. scanf("%s", s);
  15. printf("%s -> ", s);
  16. myToUpper(s);
  17. printf("%s\n", s);
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0s 5268KB
stdin
aBcDe
stdout
aBcDe -> ABCDE