当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
- Workers, workers soul, draw lifelong members, become a person!
- [开源] .Net 使用 ORM 访问 华为GaussDB数据库
- Talking about, check the history of which famous computer viruses, 80% of the people do not know!
- 构建者模式(Builder pattern)
- Google's AI model, which can translate 101 languages, is only one more than Facebook
- How to make a correct summary for 7 years?
- Summary of rendering of water wave and caustics (etching) in webgl
- 2020-11-05
- Use markdown
- 10 common software architecture patterns
猜你喜欢
Solution of DEV-C + + unable to debug in Windows Environment
搭载固态硬盘的服务器究竟比机械硬盘快多少
Tencent: Although Ali's Taichung is good, it is not omnipotent!
Apache Kylin远程代码执行漏洞复现(CVE-2020-1956)
API生命周期的5个阶段
刚刚好,才是最理想的状态
.NET 大数据量并发解决方案
Rabbitmq (1) - basic introduction
VIM configuration tutorial + source code
我们做了一个医疗版MNIST数据集,发现常见AutoML算法没那么好用
随机推荐
API生命周期的5个阶段
wanxin finance
Build simple business monitoring Kanban based on Alibaba cloud log service
框架-SPI四种模式+通用设备驱动实现-源码
Tips and skills of CSP examination
Solution of DEV-C + + unable to debug in Windows Environment
The network adapter could not establish the connection
Millet and oppo continue to soar in the European market, and Xiaomi is even closer to apple
Travel notes of Suzhou
I used Python to find out all the people who deleted my wechat and deleted them automatically
Do these mistakes in your resume affect your annual salary of one million?
Arduino ide build esp8266 development environment, slow file download solution | esp-01 make WiFi switch tutorial, transform dormitory lights
SQL 速查
大龄程序员没有出路吗?
聊聊Go代码覆盖率技术与最佳实践
Leancloud changes in October
Golang system ping program to detect the surviving host (any permission)
AI香水来了,你会买吗?
Alibaba cloud accelerates its growth and further consolidates its leading edge
Apache Kylin远程代码执行漏洞复现(CVE-2020-1956)