fork download
  1. #include <stdio.h>
  2. #include <ctype.h>
  3. #include <string.h>
  4.  
  5. int main() {
  6. char str[] = "computer programming";
  7. int length = strlen(str);
  8.  
  9. for (int i = 0; i < length; i++) {
  10. if (i % 2 == 0) {
  11. str[i] = toupper(str[i]);
  12. } else {
  13. str[i] = tolower(str[i]);
  14. }
  15. }
  16.  
  17. printf("%s\n", str);
  18. return 0;
  19. }
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
CoMpUtEr pRoGrAmMiNg