C Program Using Functions And Pointers To Change The Letters In A Sentence From Uppercase To Lowercase

/*
   C Program Using Functions And Pointers To Change The Letters In A Sentence From Uppercase To Lowercase
*/

#include<stdio.h>
#include<conio.h>

void upper_sen_to_lower(char []);

void main()
 {
  char sen[50];
  printf("Enter the sentence having length not exceed your array limit b/w 1 to       50\n");
/* As in this case max length of a sentence is 50 characters*/
 gets(sen); 
 printf("After converting a sentence from uppercase to lowercase is \n%s\n",sen);
 upper_sen_to_lower(sen);
printf("After converting a sentence from uppercase to lowercase is \n%s\n",sen);
}

void upper_sen_to_lower(char s[])
 {
  int i=0;
  while(s[i]!='\0')
   {
    if(s[i]>='A' && s[i]<='Z')
     s[i]=s[i]+32;
    i++;
   }
 }


OUTPUT:


/*
--------------------------------------------------------------------------------------
By Using of ASCII Value and puts() function
--------------------------------------------------------------------------------------
*/
#include<stdio.h>
#include<conio.h>
void upper_sen_to_lower(char []);
void main()
 {
  char sen[50];
  printf("Enter the sentence b/w 1 to 50\n");
  gets(sen);
  printf("Before converting the original sentence is \n%s\n",sen);
  upper_sen_to_lower(sen);
  printf("After converting a sentence from uppercase to lowercase is:\n");
  puts(sen);
 }
           
void upper_sen_to_lower(char s[])
 {
  int i=0;
  while(s[i]!='\0')
   {
    if(s[i]>=65 && s[i]<=90)
     s[i]=s[i]+32;
    i++;
   }
 }

OUTPUT:





Popular posts from this blog

IGNOU Solved Assignment 2023-24 | BCS-012 Basic Mathematics BCA(I)012/Assignment/2023-24

Generation Of Computer | Computer Generation | कंप्यूटर की पीढ़िया

Fibonacci Series In C-Gaurav Pali