Sunday, 20 March 2016

C Program For Upper Case And Lower Case Conversion And Vice-Versa

#include<stdio.h>
#include<string.h>

main()
{

    char str[20];
    int i;

    printf("Enter any string:\n");
    scanf("%s",str);

    for (i=0;i<=strlen(str);i++)
{

        if (str[i]>=65&&str[i]<=90)
            str[i] = str[i] + 32;

        else if (str[i] >= 97 && str[i] <= 122)
            str[i] = str[i] - 32;

    }
    printf("The lower case of given string is : %s",str);

    return 0;

}

Output:-


No comments:
Write comments

Recommended Posts × +