Problem 41

author
By Supreme2023-03-15
Problem Statement :
Write a program to convert string into upper case
Code:

#include <stdio.h>
#include <string.h>

int main(){

//41. Write a program to convert string into upper case

printf("\tConvert To Uppercase");
printf("\n=====================================\n\n");

char str[50];

printf("Enter String : ");
gets(str);

printf("\nYour String Is : ");
puts(str);

printf("\n-------------------------------------\n");
printf("\nUppercase String Is : %s",strupr(str));
printf("\n\n-------------------------------------\n");

return 0;
}

Description :
  • This is a C program to convert a given string to uppercase letters.
  • The program includes two header files: stdio.h and string.h.
  • In the main function, a character array str with a size of 50 is declared to store the input string.
  • The user is prompted to enter the string using the gets() function.
  • The strupr() function is used to convert the string to uppercase letters.
  • The uppercase string is printed on the screen using the printf() function.
Output Image:
Output-image

© Copyright 2022. All right reserved, GTU Coder.