C Program
#include <stdio.h> #include <ctype.h> int main() { char str[100]; printf("Enter a string: "); fgets(str, sizeof(str), stdin); for (int i = 0; str[i] != '\0'; i++) { str[i] = toupper(str[i]); } printf("Uppercase: %s", str); return 0; }
C Output
Input: hello world Output: Uppercase: HELLO WORLD
C++ Program
#include <iostream> #include <string> #include <cctype> using namespace std; int main() { string str; cout << "Enter a string: "; getline(cin, str); for (char &c : str) { c = toupper(c); } cout << "Uppercase: " << str; return 0; }
C++ Output
Input: coding is fun Output: Uppercase: CODING IS FUN
JAVA Program
import java.util.Scanner; public class ToUppercase { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Enter a string: "); String str = sc.nextLine(); System.out.println("Uppercase: " + str.toUpperCase()); } }
JAVA Output
Input: java programming Output: Uppercase: JAVA PROGRAMMING
Python Program
str1 = input("Enter a string: ") print("Uppercase:", str1.upper())
Python Output
Input: python rocks Output: Uppercase: PYTHON ROCKS
In-Depth Learning – Entire Concept in Paragraphs
Social Plugin