当前位置:网站首页>Chapter 2 programming exercises
Chapter 2 programming exercises
2020-11-08 16:17:00 【Wang Jing】
Chapter 2 programming exercises 1. Print name
#define NAME"Billie"
#define SURNAME"Eilish"
int main(void)
{
printf("%s %s\n",NAME,SURNAME);
printf("%s\n %s\n",NAME,SURNAME);
printf("%s",NAME);
printf("%s\n",SURNAME);
return 0;
}
2. Print name and address
#define NAME"Halsey"
#define ADDRESS"Washington,New Jersey,USA"
int main(void)
{
printf("%s\n",NAME);
printf("%s\n",ADDRESS);
return 0;
}```
3. Age and days
```#include <stdio.h>
int main(void)
{
int age,day;
age=17;
day=17*365;
printf("my age=%d days=%d",age,day);
return 0;
}```
4. Output jolly deny
```#include <stdio.h>
int jolly(void);
int deny(void);
int main(void){
jolly();
jolly();
jolly();
deny();
return 0;
}
int jolly(void){
printf("For he's a jolly good fellow!\n");
return 0;
}
int deny(void){
printf("Which nobody can deny!\n");
return 0;/*wj*/
}```
5. Output bric
```#include <stdio.h>
int br(void);
int ic(void);
int main(void){
br();
printf(",");
ic();
printf(",\n");
br();
printf("\n");
return 0;
}
int br(void){
printf("Brazil,Russia");
return 0;
}
int ic(void)
{
printf("India,China");
return 0;//wj
}```
6. Calculation toes
```#include <stdio.h>
int main(void){
int toes;
toes=10;
printf("The Variablem toes=%d.\n",toes);
printf("donble toes=%d.\n",2*toes);
printf("toes'square=%d.\n",toes*toes);
return 0;
}```
7.smile
```int smile(void);
#include <stdio.h>
int main(void) {
smile();smile();smile();
printf("\n");
smile;smile;
printf("\n");
smile;
printf("n");
return 0;
}
int smile(void){
printf("smile!");
return 0;
}```
8.one-three
```#include <stdio.h>
int one_three(void);
int two(void);
int main(void){
printf("Starting now:\n");
one_three();
printf("Done!\n");
return 0;
}
int one_three(void){
printf("one\n");
two();
printf("three\n");
return 0;
}
int two(void){
printf("two\n");
return 0;
}```
版权声明
本文为[Wang Jing]所创,转载请带上原文链接,感谢
边栏推荐
- 阿里云的MaxCompute数加(原ODPS)用的怎样?
- What are the necessary laws and regulations to know when entering the Internet?
- Elasticsearch learning one (basic introduction)
- 前后端分离跨域问题解决方案
- Awk implements SQL like join operation
- The first open source Chinese Bert pre training model in the financial field
- Flink's sink: a preliminary study
- Summary of template engine
- Huawei has an absolute advantage in the 5g mobile phone market, and the market share of Xiaomi is divided by the market survey organization
- 佛萨奇forsage以太坊智能合约是什么?以太坊全球滑落是怎么回事
猜你喜欢
随机推荐
实验
c++ opencv4.3 sift匹配
“他,程序猿,35岁,被劝退”:不要只懂代码,会说话,胜过10倍默默努力
How to solve the conflict when JD landed on Devops platform?
What are the necessary laws and regulations to know when entering the Internet?
构建者模式(Builder pattern)
二叉树的四种遍历方应用
搭载固态硬盘的服务器究竟比机械硬盘快多少
LiteOS-消息队列
Restfulapi learning notes -- father son resources (4)
It's just right. It's the ideal state
我用 Python 找出了删除我微信的所有人并将他们自动化删除了
Xiaoqingtai officially set foot on the third day of no return
契约式设计(Dbc)以及其在C语言中的应用
AI weekly: employees are allowed to voluntarily reduce salary; company response: employees are happy and satisfied; tiger tooth HR takes employees out of the company; Sweden forbids Huawei ZTE 5g equi
模板引擎的整理归纳
我们做了一个医疗版MNIST数据集,发现常见AutoML算法没那么好用
性能压测时,并发压力增加,系统响应时间和吞吐量如何变化
vim-配置教程+源码
Arduino IDE搭建ESP8266开发环境,文件下载过慢解决方法 | ESP-01制作WiFi开关教程,改造宿舍灯



