/* C Program - Convert Uppercase String to Lowercase */ #include<stdio.h> #include<conio.h> #include<string.h> void main() { clrscr(); char str[20]; int i; printf("Enter the String (Enter First Name) in uppercase : "); scanf("%s",str); for(i=0;i<=strlen(str);i++) { if(str[i]>=65 && str[i]<=92) { str[i]=str[i]+32; } } printf("\nThe String in Lowercase = %s",str); getch(); }
Concept
ASCII code of A is 65 and ASCII code of Z is 92.
ASCII code of a is 97 and Ascii code of z is 122.
No comments:
Post a Comment