alternate case in string c

Solutions on MaxInterview for alternate case in string c by the best coders in the world

showing results for - "alternate case in string c"
Lennart
03 Feb 2018
1#include <stdio.h>
2#include <ctype.h>
3
4void main()
5{
6    char s[200];
7    int i,count=0;
8
9    printf("Enter  the string : ");
10    gets(s);
11	
12    for(i=0;s[i]!='\0';i++)
13    {
14    	if(s[i]>=97 && s[i]<=122)
15    	{
16          s[i]=s[i] - 32;
17		}
18
19		else if(s[i]>=65 && s[i]<=90)
20    	{
21          s[i]=s[i] + 32;
22		}
23    }
24
25	puts(s);
26}
27
28