fork download
  1. //ReverseCaseAndString
  2. #include<stdio.h>
  3. #include<string.h>
  4. void changeCaseAndReverse(char *str){
  5. int i, len, temp;
  6. len = strlen(str);
  7. for (i=0; i<len/2;i++){
  8. temp = str[i];
  9. str[i] = str[len-i-1];
  10. str[len-i-1] = temp;
  11. }
  12. int ll = strlen(str);
  13. for (int i=0; i<ll; i++){
  14. if(str[i]>='a' && str[i]<='z')
  15. str[i]= str[i]-32;
  16. else if(str[i]>='A' && str[i]<='Z')
  17. str[i] = str[i]+32;
  18. }
  19.  
  20. }
  21.  
  22. int main(){
  23. char str[50]="abcdFRTY";
  24. int i;
  25. printf("\n Enter a string to be reversed and cased: ");
  26. //gets(str);
  27. changeCaseAndReverse(str);
  28. for(i=0;i<strlen(str);i++){
  29. printf("%c", str[i]);}
  30. return 0;
  31. }
  32.  
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
 Enter a string to be reversed and cased: ytrfDCBA