Flowchart and Algorithm to Replace Lower Case to Upper Case in a String or Sentence

[42234 views]




In this article, we will be learning how to convert all the small letters in the string to capital letters without a built-in programming function. We will draw a flowchart, write an algorithm and Simple Program in C for performing Case Conversion to Lower to Upper Case.
So Let's Start.

Flowchart to Replace Lower Case to Upper Case in a String or Sentence:

Flowchart and algorithm to read a string and replace lower case to upper case.
Remove WaterMark from Above Flowchart

Algorithm to Replace Lower Case to Upper Case in a String or Sentence:

Declare char str[100], i; Read str; for i = 0 to 100 and increment i by 1 for each iteration { if (str[i] greater than 'a' and str[i] less than 'z') { str[i] = str[i] - 32; } } print(str);

In this pseudocode, we declare an array of string str and a variable i. We read the string and then we run for loop to get each character of the string. We will check if each ASCII value of each character is between the value of a and z. If yes, then subtract 32 from each character to convert them into capital letters. For example, let us take string "tall" it will enter the loop as well as if statement now the 't'(ASCII value=116) will be subtracted with 32 to get 106 which is "T" now 'a'(97) will go inside the loop, it will convert to 65 which is "A". The same will happen with 'l' and at last, we will get "TALL" .

Program in C:

#include<stdio.h> #include<string.h> int main() { char str[100], i; printf("Enter the string :"); gets(str); for (i = 0; i < 100; i++) { if (str[i] >= 'a' && str[i] <= 'z') { str[i] = str[i] - 32; } } puts(str); }

Output of program:

C Program to read a string and replace lower case to upper case
                 



Want to Learn How to write own Algorithm and Flowcharts



Want to test your logical skills in Algorithms?


Health is Wealth? Check Best Medical Insurance for you:-



Comments










Search
Have Technical Doubts????


Hot Deals ends in













Technical Quizzes Specially For You:

Search Tags

    Flowchart to Replace Lower Case to Upper Case in Sentence

    Algorithm to Replace Lower Case to Upper Case in Sentence

    Convert From Lower Case to Upper Case Pseudocode

    C Program to convert Lower to Upper Case