第十五周项目一字符串处理

来源:互联网 发布:大质数分解算法 编辑:程序博客网 时间:2024/05/29 14:02

问题描述:输入字符串(长度20以内),将字符串中大写字母改为小写字母,其他字符不变,输出改变后的字符串。

作者:李忠林

完成日期:2016.12.13

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


int main()
{
    int i;
    char a[21];
    scanf("%s",&a);
    for(i=0; a[i]!='\0'; i++)
    {
        if((a[i]>='A')&&(a[i]<='Z'))
        {
            printf("%c",a[i]+32);
        }
        else


            printf("%c",a[i]);
    }
    return 0;


}

运行结果


0 0