fork download
  1. #include <stdio.h>
  2. #include <ctype.h>
  3.  
  4. #define SIZE 100
  5.  
  6. int main(void)
  7. {
  8. char s[SIZE];
  9.  
  10. printf("Enter a line of text: ");
  11. fgets(s, SIZE, stdin);
  12.  
  13. printf("\nThe line in uppercase is:\n");
  14.  
  15. for (int i = 0; s[i] != '\0'; ++i)
  16. {
  17. printf("%c", toupper((unsigned char)s[i]));
  18. }
  19.  
  20. printf("\nThe line in lowercase is:\n");
  21.  
  22. for (int i = 0; s[i] != '\0'; ++i)
  23. {
  24. printf("%c", tolower((unsigned char)s[i]));
  25. }
  26.  
  27. return 0;
  28. }
Success #stdin #stdout 0s 5344KB
stdin
Standard input is empty
stdout
Enter a line of text: 
The line in uppercase is:
���
The line in lowercase is:
���