当前位置:网站首页>"C language programming", 4th Edition, edited by he Qinming and Yan Hui, after class exercise answers Chapter 3 branch structure
"C language programming", 4th Edition, edited by he Qinming and Yan Hui, after class exercise answers Chapter 3 branch structure
2022-07-02 01:43:00 【Bathe in the four seasons】
The first 3 Chapter after class practice answers
P057
#include<stdio.h>
int main(void)
{
/* Statistical characters ( practice 3-4)*/{
int n,i,letter=0,digit=0,count=0,other=0;
char ch;
printf("Enter n:");
scanf("%d",&n);
getchar();
printf(" Input %d Characters :",n);
for(i=1;i<=n;i++)
{
ch=getchar();
if((ch>='a'&&ch<='z')||(ch>='A'&&ch<='Z'))
letter++;
else if(ch>='0'&&ch<='9')
digit++;
else if(ch==' '||ch=='\n')
count++;
else other++;
}
printf("letter=%d,digit=%d,count( Space or car )=%d,other=%d\n",letter,digit,count,other);}
printf("\n");
/* Output leap year ( practice 3-5)*/{
int m=2000,n,y;
printf("Enter n(21 One year in the century ):");
scanf("%d",&n);
printf("21 By the middle of the century %d There are leap years before :",n);
for(y=m;y<=n;y++)
{
if((y%4==0&&y%100!=0)||(y%400==0))
printf("%d\t",y);
else ;
}
}
return 0;
}P064
#include<stdio.h>
int main(void)
{
/* Achievement transformation ( practice 3-7)*/
int score;
printf("Enter score(1~100):");
scanf("%d",&score);
printf(" Enter the percentile score %d The corresponding five point score is :",score);
if(score>=90)
putchar('A');
else if(80<=score)
putchar('B');
else if(70<=score)
putchar('C');
else if(60<=score)
putchar('D');
else putchar('E');
printf("\n\n");
/* Check the unit price of fruit ( practice 3-8)*/
int i,choice;
double price;
printf("[1]appples\n[2]pears\n[3]oranges\n[4]grapes\n[0]exit\n");
for(i=1;i<=5;i++)
{
printf("Enter choice:");
scanf("%d",&choice);
if(choice==0)
break;
else
switch(choice){
case 1:price=3.00;break;
case 2:price=2.50;break;
case 3:price=4.10;break;
case 4:price=10.20;break;
default:price=0;break;
}
printf("price=%.1lf\n",price);
}
return 0;
}边栏推荐
- Raspberry pie 4B learning notes - IO communication (1-wire)
- 1218 square or round
- ES6 new method of string
- uTools
- Docker安装Oracle_11g
- 如何远程、在线调试app?
- VARIATIONAL IMAGE COMPRESSION WITH A SCALE HYPERPRIOR文献实验复现
- [IVX junior engineer training course 10 papers] 06 database and services
- Ubuntu20.04 PostgreSQL 14 installation configuration record
- ECS project deployment
猜你喜欢
![[image enhancement] vascular image enhancement based on frangi filter with matlab code](/img/b3/b4164fb7db8645f470180e352b5717.png)
[image enhancement] vascular image enhancement based on frangi filter with matlab code

Docker installing Oracle_ 11g
![[disease detection] realize lung cancer detection system based on BP neural network, including GUI interface](/img/c9/3fe8693629a8452dcfdb4349ddee0d.png)
[disease detection] realize lung cancer detection system based on BP neural network, including GUI interface

现货黄金分析的技巧有什么呢?

Android high frequency network interview topic must know and be able to compare Android development environment

Finally got byte offer, 25-year-old inexperienced experience in software testing, to share with you
![[Floyd] post disaster reconstruction](/img/7a/f72c7781ef148212c870a56fb9a607.jpg)
[Floyd] post disaster reconstruction

Unity AssetBundle subcontracting
![[IVX junior engineer training course 10 papers] 06 database and services](/img/68/967566fc2f1d0b93ecd78bdb208b64.jpg)
[IVX junior engineer training course 10 papers] 06 database and services

并发编程的三大核心问题
随机推荐
uTools
Learning note 3 -- Key Technologies of high-precision map (Part 1)
matlab 使用 resample 完成重采样
6-2 vulnerability exploitation - inevitable problems of FTP
Ks006 student achievement management system based on SSM
学习笔记24--多传感器后融合技术
ES6 new method of string
卷积神经网络(包含代码与相应图解)
Edge computing accelerates live video scenes: clearer, smoother, and more real-time
城市选择器组件实现原理
Six lessons to be learned for the successful implementation of edge coding
D discard the virtual recovery method
[Chongqing Guangdong education] Tianshui Normal University universe exploration reference
TSINGSEE青犀平台如何实现同一节点同时播放多个视频?
Number of palindromes in C language (leetcode)
matlab 实现语音信号重采样和归一化,并播放比对效果
开发那些事儿:如何利用Go单例模式保障流媒体高并发的安全性?
LeetCode、3无重复最长子序列
How can the tsingsee Qingxi platform play multiple videos at the same time on the same node?
【LeetCode 43】236. The nearest common ancestor of binary tree