C Programming – HackerRank Solution | Replace upper case with lower case |

(HackerRank) Write a Modular C Programming code to solve Replace upper case with lower case, Given a string replace every occurrence of upper case character with the lower case.

Given a string replace every occurrence of upper case character with the lower case.

Input Format

First Line contains a string

Constraints

1<= |S| < = 1000

Output Format

Output the string where every occurrence of upper case is replaced with lower case.

Sample Input 0

aBcD12&q

Sample Output 0

abcd12&q

Refer : C Programming HackerRank all solutions for Loops | Arrays | strings | Data Structures | Linked lists | Stacks | Queues | Binary Trees

 

CODE:

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

int main() {
    char word[20];
    int i=0;
    scanf("%s",word);
    while(word[i])
    {
        if(word[i]>=65 && word[i]<=90)
            word[i]+=32;
        i++;
    }
    printf("%s",word);
    return 0;
}

OUTPUT

Congratulations, you passed the sample test case.

Click the Submit Code button to run your code against all the test cases.

Input (stdin)

aBcD12&q
Your Output (stdout)

abcd12&q
Expected Output

abcd12&q

 

Please find some more codes of Loops, Condition Statements, 1D Arrays, 2D Arrays, Strings, Pointers, Data Structures, Files, Linked lists, Stacks, Queues, Binary Trees, MISC, Solved model question papers & Hacker Rank all solutions on the below page:

Top 100+ C Programming codes – KLE Technological University







Leave a Comment

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

Welcome to FactsPrime

Sorry, We have detected that you have activated Ad-Blocker. Please Consider supporting us by disabling your Ad Blocker, It helps us in maintaining this website. To View the content, Please disable adblocker and refresh the page.

Thank You !!!