Write a program to convert the given string into upper character in c

20 Sep 2022 Balmiki Mandal 0 C Programming

C Program to Convert a String to Uppercase

Converting a given string into upper characters means converting all the lowercase letters in the string into their corresponding uppercase letters. For example, if we have the string "Hello, World!", converting it into upper characters would result in "HELLO, WORLD!".

In C programming language, we can achieve this by iterating through each character in the string and converting any lowercase letters to uppercase letters using a built-in function such as toupper() from the ctype.h library.

c program to convert the given string into an upper character 

#include
void main()
{
    char s[10];
    int i;
    printf("Enter the string:");
    scanf("%s",s);
    printf("Before:%s\n",s);
    for(i=0;s[i];i++)
    {
        s[i]=s[i]-32;
    }
    printf("after:%s",s);
    printf("\n");
}

Output:

Enter the string: balmiki
Before: balmiki
after: BALMIKI

Further Reading:

Concatenating Two Strings in C: A Step-by-Step Guide

Design a function to count given character in given string

Design a function to reverse the given string

Design a function to search given character in given string in c

Design a function to reverse the word in given string

Design a function replace the words in reverse order in a given string line

Design a function to find string length in c

Design a Function to print the string character by character

Enroll Now:

C-Programming From Scratch to Advanced 2023-2024] "Start Supercharging Your Productivity!"

Contact Us:

  • For any inquiries, please email us at [[email protected]].
  • Follow us on insta  [ electro4u_offical_ ] for updates and tips.

 

Note: If you encounter any issues or specific errors when running this program, please let me know and I'll be happy to help debug them!

BY: Balmiki Mandal

Related Blogs

Post Comments.

Login to Post a Comment

No comments yet, Be the first to comment.