当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
- Comics: looking for the best time to buy and sell stocks
- [open source]. Net uses ORM to access Huawei gaussdb database
- 小米、OPPO在欧洲市场继续飙涨,小米更是直逼苹果
- Welcome to offer, grade P7, face-to-face sharing, 10000 words long text to take you through the interview process
- Golang ICMP协议探测存活主机
- 10个常见的软件架构模式
- How to cooperate with people in software development? |Daily anecdotes
- Awk implements SQL like join operation
- 机械硬盘随机IO慢的超乎你的想象
- How does Alibaba cloud's maxcompute add (original ODPs) work?
猜你喜欢
漫画:寻找股票买入卖出的最佳时机(整合版)
Is there no way out for older programmers?
搭载固态硬盘的服务器究竟比机械硬盘快多少
我用 Python 找出了删除我微信的所有人并将他们自动化删除了
“他,程序猿,35岁,被劝退”:不要只懂代码,会说话,胜过10倍默默努力
AI香水来了,你会买吗?
Application of four ergodic square of binary tree
uni-app实战仿微信app开发
laravel8更新之速率限制改进
We made a medical version of the MNIST dataset, and found that the common automl algorithm is not so easy to use
随机推荐
基于阿里云日志服务快速打造简版业务监控看板
Learn to record and analyze
学习记录并且简单分析
CSP考试须知与各种小技巧
新型存算一体芯片诞生,利好人工智能应用~
技术总监7年总结,如何进行正确的沟通?
Js中常见的内存泄漏场景
write文件一个字节后何时发起写磁盘IO
Do these mistakes in your resume affect your annual salary of one million?
Apache Kylin远程代码执行漏洞复现(CVE-2020-1956)
浅谈,盘点历史上有哪些著名的电脑病毒,80%的人都不知道!
2020-11-05
I used Python to find out all the people who deleted my wechat and deleted them automatically
Returning to the third place in the world, what did Xiaomi do right?
How does Alibaba cloud's maxcompute add (original ODPs) work?
机械硬盘随机IO慢的超乎你的想象
Development of uni app imitating wechat app
Rabbitmq (1) - basic introduction
TypeScript(1-2-2)
Leancloud changes in October