Bhuvan InfoTech Android App

Download our Android App and browse Technical News, Projects, Computer Tricks more easily with lots of Interesting Features.

Tuesday, June 14, 2016

Toggle case of each character in String | C program

#include <stdio.h> int main(){ char strin[100]; int i; printf("enter a string to toggle: "); fgets(strin, 100, stdin); for(i=0;strin[i]!=NULL;i++) { if(strin[i]>='A'&& strin[i]<='Z') strin[i]+=32; else if(strin[i]>='a'&&strin[i]<='z') strin[i]-=32; } printf("String after toggle is: %s",strin); return 0; }
Bhuvan Arora

No comments:

Amazing Deal !