Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

how to write a C-program that reads a capital letter character and converts it to small letter character ?

0 votes
asked Feb 15, 2020 by faridabaky11 (120 points)
how to write a C-program that reads a capital letter character and converts it to small letter character?

4 Answers

0 votes
answered Feb 16, 2020 by anonymous
if the ascii value of a character is less than that of 'Z' then it a capital number. add (int)'a'-(int)'A' to your characters of the string with the above condition
0 votes
answered Feb 17, 2020 by Manikumar T (140 points)
#include<stdio.h>

int main( )

{

     char a[10];

     printf("Enter the Capital Letters:");

     scanf("%s",a);

     int i;

     for(i=0;a[i]!='\0';i++)

     {

          if(a[i]>='A' && a[i]<='Z')

          {

             a[i] = a[i] + 32;

          }

    }

printf("converted Small Letters:%s",a);

}
0 votes
answered Feb 17, 2020 by anonymous
#include <stdio.h>
#include <ctype.h>

void main()
{
    
    char input[10] = "helloHeLlO";
    int counter = 0;
    
    printf("String currently is: ");
    
    for(counter = 0; counter < 10; counter++){   
        printf("%c", input[counter]);
    }
    
    for(counter = 0; counter < 10; counter++){
    
        if(islower(input[counter])){
              continue;
        }
        else{
            input[counter] = tolower(input[counter]);
        }
    }
    
    printf("\nString converted to all lowercase is: ");
    for(counter = 0; counter < 10; counter++){   
        printf("%c", input[counter]);
    }
    
}
0 votes
answered Feb 17, 2020 by AMIT kumar (140 points)
#include<stdio.h>
int main(){
    char c;
    printf("enter the capital letter\n");
    scanf("%c",&c);
    printf("small letter:%c",c+32);
}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...