Q:

C Program to convert string in upper case and lower case

0

C Program to convert string in upper case and lower case

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include<stdio.h>
 
int main()
{
    char text[100];
    int i;
     
    printf("Enter any string: ");
    gets(text);
     
    printf("Entered string is: %s\n",text);
     
   
    for(i=0;text[i]!='\0';i++)
    {
        if(text[i]>='a' && text[i]<='z')
            text[i]=text[i]-0x20;
    }
    printf("String in Upper case is: %s\n",text);
     
   
    for(i=0;text[i]!='\0';i++)
    {
        if(text[i]>='A' && text[i]<='Z')
            text[i]=text[i]+0x20;
    }
    printf("String in Lower case is: %s\n",text);
 
    return 0;
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now