Solved programming problem

Convert a string to Uppercase in C.

Source code

#include <stdio.h>

int main()

{

    char str[100];

    int i;

    printf("Please Enter Massage: ");

    gets(str);

    for(i=0; str[i]!=''; i++)

    {

        if(str[i]>='a' && str[i]<='z')  ///checking if the alphabet is lowercase or not

        {

            str[i]=str[i]-32;   /// making uppercase alphabet

        }

    }

    printf("
Your Massage is: %s
",str);

    return 0;

}

Output

Please Enter Massage: code to haven

Your Massage is: CODE TO HAVEN

Join the discussion

Add your comment