Problem statement:- Program to Convert Uppercase to lowercase without using the inbuilt function.
Sample Input/Output:-
Data requirement:-
Input Data:- str
Output Data:-str
Output Data:-str
Additional Data:- i
Program in C
Here is the source code of the C Program to Convert Uppercase to lowercase without 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); int i = 0; //convert capital letter string to small letter string while (str[i] != '\0') { if (str[i] > 64 && str[i] < 91) //or if(str[i]>='A' && str[i]<='Z') str[i] += 32; i++; } printf("Lower case String is:%s", str);}
Input/Output:
Enter your String(Upper case):CSINFO360.COM
Lower case String is: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 without 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 i = 0; //convert capital letter string to small letter string while (str[i] != '\0') { if (str[i] > 64 && str[i] < 91) //or if(str[i]>='A' && str[i]<='Z') str[i] += 32; i++; } cout << "Lower case String is: " << str;}
Input/Output:
Enter your String(Upper case):CSINFO 360 COM
Lower case String is: 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 without using the inbuilt function.
Code:
import java.util.Scanner;
public class UppercaseToLowercase{
public static void main(String[] args) { Scanner cs = new Scanner(System.in); String str, str2 = " "; char c = ' '; System.out.println("Enter your String(Upper case):"); str = cs.nextLine(); str += '\0'; int i = 0; // convert capital letter string to small letter string while (str.charAt(i) != '\0') { if (str.charAt(i) > 64 && str.charAt(i) < 91)// or if(str.charAt(i)>='A' && str.charAt(i)<='Z') c = (char) (str.charAt(i) + 32); else c = (char) (str.charAt(i)); str2 += c; i++; } System.out.println("Lower case String is: " + str2); cs.close(); }}
Enter your String(Upper case):
csinfo360
Lower case String is: csinfo360
csinfo360
Lower case String is: csinfo360
Program in Python
Here is the source code of the Python Program to Convert Uppercase to lowercase without using the inbuilt function.
Code:
str = input("Enter the String(Upper case):")i = 0ch2 = ''# convert capital letter string to small letter stringwhile str[i:]: ch = ord(str[i]) if ch > 64 and ch < 91: ch2 += chr(ch+32) else: ch2 += chr(ch) i += 1print("Lower case String is:", ch2)
Input/Output:
Enter the String(Upper case):CSINFO
Lower case String is: csinfo
Lower case String is: csinfo
Most Recommend Questions:-
More Questions:-
0 Comments
Please do not Enter any spam link in the comment box