C program to convert lowercase string to Uppercase


#include<stdio.h>
int main()
{
    char a[50];
    int i=0;
    printf("Enter a lowercase String: ");
    gets(a);
    while(a[i]!='\0')
    {
        if(a[i]>95 && a[i]<122)
            printf("%c",a[i]-32);
        else
            printf("%c",a[i]);
        i++;
    }
    return 0;
}

OUTPUT:
Enter a lowercase String: simpleway2code

SIMPLEWAY2CODE

Post a Comment

4 Comments

  1. what to change for uppercase to lowercase>?

    ReplyDelete
  2. lowercase to uppercase means small letters will be converted into Capital letters

    ReplyDelete
    Replies
    1. sorry i meant can u tell me the program to change uppercase to lowercase,should the only change be a[i]+32 tochange tolowercase

      Delete