Write a program to read a sentence and replace lowercase characters by uppercase and vice-versa


Write a program to read a sentence and replace lowercase characters by uppercase and vice-versa
  1. #include<stdio.h>
  2. #include<string.h>
  3. void main()
  4. {
  5.     char str[100];
  6.     char ch;
  7.  
  8.     int len;
  9.     printf("Input the string: ");
  10.     gets(str);
  11.     len=strlen(str);
  12.  
  13.     for(int i=0; i<len; i++) {
  14.         ch = (islower(str[i])?toupper(str[i]):tolower(str[i]));
  15.     printf("%c", ch);
  16.     }
  17. }

একটি মন্তব্য পোস্ট করুন