[HDU] [1161] Eddy's mistakes

Problem Description

Loading...

Problem Analysis

Convert all uppercase letters in the string
to lowercase letters

cpp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#include<stdio.h>
#include<string.h>
char s[1020];
int main() {
	while(gets(s)!=NULL) {
		int l=strlen(s);
		for(int i=0; i<l; i++) {
			if(s[i]<='Z'&&s[i]>='A') {
				printf("%c",s[i]-('A'-'a'));
			} else
				printf("%c",s[i]);
		}
		printf("\n");
	}
	return 0;
}

Problem link: 【杭电】[1161]Eddy’s mistakes

This post is licensed under CC BY-NC-SA 4.0. If it helped, or if you have anything to say, the comment box below is open.
Page views —
Unique visitors —

Loading...