Write a C Program to toggle case in a string



Sumit Kar,String, Toggle Case




#include <stdio.h>





void main()



{



 char str[100];



 int i;



 printf("Please enter a string: ");







 fgets(str, 100, stdin);







 for(i=0;str[i]!=NULL;i++)



 {



  if(str[i]>='A'&&str[i]<='Z')



   str[i]+=32;



  else if(str[i]>='a'&&str[i]<='z')



   str[i]-=32;



 }







 printf("String in toggle case is: %s",str);









}






Comments

Popular posts from this blog

Write a Program to Add two 3x3 Matrix using C

C program for Unit Conversion

Write a Program to Add two 5x5 Matrix using C