题解 | #计算某字符出现次数#

计算某字符出现次数

https://www.nowcoder.com/practice/a35ce98431874e3a820dbe4b2d0508b1

#include <stdio.h>

#include<ctype.h>

int main() {

int a = 0, b = 0,len=0;
char i, j, s[1000];
gets_s(s);
scanf("%c",&i);
char *p = s;
i = tolower(i);
while (*p != 0) {
    s[a] = tolower(s[a]);
    if (s[a] == i) {
        b++;
    }
    a++;
    p++;
    
}

printf("%d", b);
return 0;

}

全部评论

相关推荐

05-03 12:45
西南大学 Java
nsnzkv:你这项目写的内容太多了,说实话都是在给自己挖坑,就算简历过了,后面面试也难受
点赞 评论 收藏
分享
哥_留个offer先:跟他说,你这个最好用c#,微软就用c#Java不适合这个项目
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务