#include<stdio.h>
void main() {
char str[100];
int i;
printf("Please enter a string: ");
gets(str);
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);
}
Note: Remove the comment line when you are use Turbo C IDE for run your program.
Monday, 5 October 2015
Write a program convert character(String) into TOggLe character(String)
Labels:
C,
GTU Practical
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment