Convert Uppercase to Lowercase using string function

Problem statement:- Program to Convert Uppercase to Lowercase using the inbuilt function.

Data requirement:-

   Input Data:- str

  Output Data:-str

Program in C

Here is the source code of the C Program to Convert Uppercase to Lowercase using the inbuilt function.

Code:

#include<stdio.h>
#include<string.h>
int main()
{
    char str[30];
    printf("Enter your String(Upper case):");
    scanf("%[^\n]",str);
printf("Lower case String is:%s",strlwr(str));/*strlwr convert capital letter string to small letter string*/
}

Input/Output:
Enter your String(Upper case):CSINFO360.COM
Lower case String is:csinfo360.com

Program in C++

Here is the source code of the C++ Program to Convert Uppercase to Lowercase using the inbuilt function.

Code:

#include<iostream>
#include<cstring>
using namespace std;
int main()
{
    string str;
    cout<<"Enter your String(Upper case):";
    getline(cin,str);
    int len=0;
    string str2="";
    while(str[len]!='\0')
    {
        str2+=tolower(str[len]);
        len++;
    }
    cout<<"Lower case String is: "<<str2;
}

Input/Output:
Enter your String(Upper case):CSINFO 360 COM
Lower case String is: csinfo 360 com

Program in Java

Here is the source code of the Java Program to Convert Uppercase to Lowercase using the inbuilt function.

Code:

import java.util.Scanner;
public class p4 {

public static void main(String[] args) {
Scanner cs=new Scanner(System.in);
String str;
System.out.println("Enter your String(Upper case):");
str=cs.nextLine();
System.out.println("Lower case String is: "+str.toLowerCase());
cs.close();
}
}

Input/Output:
Enter your String(Upper case):
csinfo360
Lower case String is: csinfo360

Program in Python

Here is the source code of the Python Program to Convert Uppercase to Lowercase using the inbuilt function.

Code:

str=input("Enter the String(Upper case):")
print("Lower case String is:", str.lower())

Input/Output:
Enter the String(Upper case):CSINFO
Lower case String is: csinfo

Post a Comment

0 Comments