Program to convert upper case string into lower case string

 Problem statement
Write a c program to convert a upper case string into lower case string
#include<stdio.h>
int main()
{
  char a[20];
  int i=0;
  printf("\n\t*******************************");
  printf("\n\tUpper Case To Lower Case String");
  printf("\n\t*******************************");
  printf("\n\n\tEnter the UPPER case string:");
  scanf("%s",&a);                                                             /* scanning string */
  printf("\n\tThe lower case String is:");
  while(a[i]!='\0')
  {
    printf("%c",a[i]+32);                      /* as lower case character has ansii code 32 more then upper case */
    i++;
   }
   return 0;
}

No comments:

Post a Comment