C Program to convert lowercase string to uppercase


In this program, You will learn how to convert lowercase string to uppercase in c.


hello abc => Hello Abc

welcome to xiith => Welcome to Xiith


Example: How to convert lowercase string to uppercase in c

Run it Now
#include<stdio.h>

int main(){

    char str[100];
    int i=0;

    printf("Enter a String :");
    fgets(str,100,stdin);

    while(str[i] != '\0'){
        i++;
    }

    for(int j = 0; j < i; j++){
        if(str[j] >= 97 && str[j]<=122)
            str[j] = str[j]-32;
    }
    printf("\nUpperCase String is :%s",str);

    return 0;
}

Output:

Enter a String :john smith
UpperCase String is :JOHN SMITH