In the program, the actual code of conversion of string to upper case is present in main() function. An array of char type s[100] is declared which will store the entered string by user. The string in converts all characters of the string into upper case letter. The scan string character by character and keep checking the index. If a character in an index is in lower case, then subtract 32 to convert it in upper case.
// Write a program to convert string to upper case in c program #include<stdio.h> int main() { char a[100]; int i; printf("\nEnter The String : "); gets(a); for(i=0;a[i]!='\0';i++) { if(a[i]>=97 && a[i]<=122) a[i]=a[i]-32; } puts(a); return 0; }To download raw file Click Here
Enter The String : tutor joes TUTOR JOES
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions