C Program to Convert Lowercase String to Uppercase



In this program, we will take an lower case string as input from user and convert that into upper case string.



  1. //C program to convert string from lowercase to upper case
  2. int main(){
  3. char str[50];
  4. int i;
  5. printf("Enter the string:");
  6. scanf("%s",str);
  7. for(i=0;i<=strlen(str);i++){
  8. if(str[i]>=97&&str[i]<=122)
  9. str[i]=str[i]-32;
  10. }
  11. printf("\nUpper Case String is: %s",str);
  12. return 0;
  13. }

Output


Output!