Monday, 27 November 2017

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

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

Featured Post

TCS Latest Test Patern ( For On-Campus Drives )

Tata Consultancy Services is software services consulting company whose  headquarter is situated in Mumbai, India. It is the Asia’s larges...