lower case
characters (a to z) have ASCII values ranging from 97 to 122 and their corresponding upper case
characters (A to Z) have ASCII values 32 less than them. ‘a’
has a ASCII value 97 and ‘A
’ has a ASCII value 65 (97-32). Same applies for other alphabets. Based on this logic we have written the below C program for conversion.#include<stdio.h>
#include<string.h>
int main(){
char str[25];
int i;
printf("Enter the string:");
scanf("%s",str);
for(i=0;i<=strlen(str);i++){
if(str[i]>=97&&str[i]<=122)
str[i]=str[i]-32;
}
printf("\nUpper Case String is: %s",str);
return 0;
}
Enter the string:www.freetimelearning.com
Upper Case String is: WWW.FREETIMELEARNING.COM