Stucking somewhere - Change in case
You will be given a single string and two positive integers denoting indices. You need to change the case of the characters at those indices,i.e change uppercase to lowercase and lowercase to uppercase. It is guaranteed that all characters in the string are alphabets. Input: The first line contains N, the length of string. The next line contains a single string. Two integers, x and y, in next line separated by space. Output: Print the string after altering the case of characters at those indices Sample Input: 6 Dcoder 0 3 Sample Output: dcoDer #include <stdio.h> #include <string.h> int main() { int n, a, b, i, j; scanf("%d", &n); char str[n]; scanf("%s", str); scanf("%d %d", &a, &b); for(i=0; i<n; i++) { if(str[i] == str[a] && str[i] < 97) str[a] += 32; else if(str[i] == str[a] && str[i] >= 97) str[a] -= 32; if(str[i] == str[b] && str[i] < 97) str[b] += 32; else if(str[i] == str[b] && str[i] >= 97) str[b] -= 32; printf("%c", str[i]); } return 0; } Getting output dcoder