当前位置:网站首页>Function: calculates the number of uppercase letters in a string
Function: calculates the number of uppercase letters in a string
2022-07-06 14:35:00 【|Light|】
requirement
Make up a name countc function , Requirements are as follows :
Formal parameters :array The character array name of the string
function : Statistics array The number of uppercase letters in the array
Return value : The number of uppercase letters in the string
Code
#include<string.h>
/* * In this function, you can count the uppercase letters in the string */
int countc(char a[])
{
int sum=0;
int i;
for(i=0;i<100;i++)
{
if(a[i]=='\0')
break;
else if(a[i]>='A'&&a[i]<='Z')
sum = sum+1;
}
return sum;
}
test
Test input
dfaDASFA4rdfsFDGSdfsgh
Output
The number of capital letters is 9
边栏推荐
猜你喜欢

High concurrency programming series: 6 steps of JVM performance tuning and detailed explanation of key tuning parameters

Mysql的事务是什么?什么是脏读,什么是幻读?不可重复读?

内网渗透之内网信息收集(五)

《统计学》第八版贾俊平第五章概率与概率分布

captcha-killer验证码识别插件

Captcha killer verification code identification plug-in

“人生若只如初见”——RISC-V

How does SQLite count the data that meets another condition under the data that has been classified once

Uibutton status exploration and customization

《统计学》第八版贾俊平第四章总结及课后习题答案
随机推荐
《统计学》第八版贾俊平第六章统计量及抽样分布知识点总结及课后习题答案
Record an API interface SQL injection practice
MSF generate payload Encyclopedia
记一次edu,SQL注入实战
Statistics, 8th Edition, Jia Junping, Chapter 6 Summary of knowledge points of statistics and sampling distribution and answers to exercises after class
Intranet information collection of Intranet penetration (I)
c语言学习总结(上)(更新中)
我的第一篇博客
“人生若只如初见”——RISC-V
[issue 18] share a Netease go experience
DVWA (5th week)
New version of postman flows [introductory teaching chapter 01 send request]
The most popular colloquial system explains the base of numbers
【指针】统计一字符串在另一个字符串中出现的次数
Network technology related topics
Binary search tree concept
Markdown font color editing teaching
Attack and defense world misc practice area (GIF lift table ext3)
Pointeurs: maximum, minimum et moyenne
MySQL interview questions (4)