C语言OJ项目参考(2886)大写改小写

    xiaoxiao2026-05-05  9

    2886: 大写改小写

    Description 输入字符串(长度20以内),将字符串中大写字母改为小写字母,其他字符不变,输出改变后的字符串。 Input 一个字符串(长度20以内) Output 输出改变后的字符串(改变规则:将字符串中大写字母改为小写字母,其他字符不变) Sample Input** ABC123bus Sample Output abc123bus

    参考解答:

    #include <stdio.h> int main( ) { char s[20]; int i=0; gets(s); while(s[i]!='\0') { if(s[i]>='A'&&s[i]<='Z') printf("%c",s[i]+32); else printf("%c",s[i]); i++; } printf("\n"); return 0; } 相关资源:大写字母变成小写字母的C语言实现
    最新回复(0)