Saturday 30 September 2017

Upper case String to Lower case string

/* C Program - Convert Uppercase String to Lowercase */
  
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
  clrscr();
  char str[20];
  int i;
  printf("Enter the String (Enter First Name) in uppercase : ");
  scanf("%s",str);
  for(i=0;i<=strlen(str);i++)
  {
     if(str[i]>=65 && str[i]<=92)
     {
  str[i]=str[i]+32;
     }
  }
  printf("\nThe String in Lowercase = %s",str);
  getch();
}

Concept 

ASCII code of A is 65 and ASCII code of Z is 92.
ASCII code of a is 97 and Ascii code of z is 122.

No comments:

Post a Comment

Convert a square matrix to Lower and Upper Triangular Matrix

Upper and Lower triangle Matrix Using C program In this program we will be discussing on how to convert a square matrix into correspon...