CodeEval Easy Level Challenge Lowercase

CodeEval Easy Level Challenge Lowercase:

Click here to go to this problem.


For this problem we just need to change upper case letters to lower case. Here i have solved this problem in 4 programming languages c, c++, java, python.

 * Author: Quickgrid ( Asif Ahmed )
 * Site:

#include <stdio.h>
int main(int argc, const char * argv[]) {
    FILE *file = fopen(argv[1], "r");
    char line[1024];
    while (fgets(line, 1024, file)) {
        for(register unsigned int i=0; line[i]; ++i){
            if(line[i] >= 'A' && line[i]<='Z') printf("%c", line[i]+32);
            else printf("%c", line[i]);
    return 0;

 * Author: Quickgrid ( Asif Ahmed )
 * Site:

public class Main {
    public static void main (String[] args) throws IOException {
        File file = new File(args[0]);
        BufferedReader buffer = new BufferedReader(new FileReader(file));
        String line;
        while ((line = buffer.readLine()) != null) {
            line = line.trim();
            // Instead of changing case one by one in for loop, we can also change case of whole string in one function call
            /* System.out.println(line.toLowerCase()); */
            for(int i=0; i<line.length(); ++i){
                char c = line.charAt(i);
                if(Character.isUpperCase(c)) System.out.print(Character.toLowerCase(c));
                else System.out.print(c);

Python (Python 3):
# Author: Quickgrid ( Asif Ahmed )
# Site:

import sys
test_cases = open(sys.argv[1], 'r')
for test in test_cases:


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s