练习1-1

  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int a;
  5. a = 15;
  6. int b;
  7. b = 37;
  8. int c;
  9. c = a - b;
  10. printf("%d-%d的结果是%d.", a, b, c);
  11. return 0;
  12. }

练习1-2

  1. #include <stdio.h>
  2.  
  3. int main() {
  4. printf("天\n地\n人\n");
  5. return ;
  6. }

练习1-3

  1. #include <stdio.h>
  2.  
  3. int main() {
  4. printf("喂!\n \n您好!\n再见。");
  5. return ;
  6. }

练习1-4

  1. #include <stdio.h>
  2.  
  3. int main() {
  4.  
  5. int x = 3.14;
  6. printf("%d", x);
  7. return ;
  8. }

结果会输出  3 因为int只能输出整数,小数部分会被忽略。

练习1-5

  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int x;
  5.  
  6. printf("请输入一个整数:");
  7. scanf("%d", &x);
  8. printf("该整数加上12的结果是%d.",x+);
  9. return ;
  10. }

练习1-6

  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int x;
  5.  
  6. printf("请输入一个整数:");
  7. scanf("%d", &x);
  8. printf("该整数减去6的结果是%d.",x-);
  9. return ;
  10. }

练习1-7

  1. #include <stdio.h>
  2.  
  3. int main() {
  4. puts("天");
  5. puts("地");
  6. puts("人");
  7.  
  8. return ;
  9. }

练习1-8

  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int x;
  5. int y;
  6. int z;
  7.  
  8. puts("请输入两个整数");
  9. printf("整数1:");
  10. scanf("%d", &x);
  11. printf("整数2:");
  12. scanf("%d", &y);
  13. z = x * y;
  14. printf("它们的乘积是:%d", z);
  15.  
  16. return ;
  17. }

练习1-9

  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int x;
  5. int y;
  6. int z;
  7. int sum;
  8.  
  9. puts("请输入三个整数");
  10. printf("整数1:");
  11. scanf("%d", &x);
  12. printf("整数2:");
  13. scanf("%d", &y);
  14. printf("整数3:");
  15. scanf("%d", &z);
  16. sum = x + y + z;
  17. printf("它们的和是:%d", sum);
  18.  
  19. return ;
  20. }

明解C语言 入门篇 第一章答案的更多相关文章

  1. 明解C语言 入门篇 第二章答案

    练习2-1 #include <stdio.h> int main() { int x; int y; int percent; puts("请输入两个整数"); pr ...

  2. 明解C语言 中级篇 第一章答案

    练习1-1 #include <stdio.h> #include<stdlib.h> int main() { srand(time()); ; printf("您 ...

  3. 明解C语言 入门篇 第九章答案

    练习9-1 /* 将字符串存储在数组中并显示(其2:初始化) */ #include <stdio.h> int main(void) { char str[] = "ABC\0 ...

  4. 明解C语言 入门篇 第八章答案

    练习8-1 #include<stdio.h> #define diff(x,y)(x-y) int main() { int x; int y; printf("x=" ...

  5. 明解C语言 中级篇 第二章答案

    练习2-1 /* 倒计时后显示程序运行时间 */ #include <time.h> #include <stdio.h> /*--- 等待x毫秒 ---*/ int slee ...

  6. 明解C语言 入门篇 第十章答案

    练习10-1 #include <stdio.h> void adjust_point(int*n) { ) *n = ; ) *n = 0; } int main() { int x; ...

  7. 明解C语言 入门篇 第五章答案

    练习5-1 /* 依次把1.2.3.4.5 赋值给数组的每个元素并显示(使用for语句) */ #include <stdio.h> int main(void) { int i; ]; ...

  8. 明解C语言 入门篇 第四章答案

    练习4-1 #include <stdio.h> int main(void) { int no; int x; do{ printf("请输入一个整数:"); sca ...

  9. 明解C语言 入门篇 第三章答案

    练习3-1 #include <stdio.h> int main() { int x; int y; puts("请输入两个整数."); printf("整 ...

随机推荐

  1. 一个原生JS实现的不太成熟的贪吃蛇游戏

    一个初初初初级前端民工 主要是记录一下写过的东西,复习用 大佬们如果看到代码哪里不符合规范,或者有更好写法的,欢迎各位批评指正 十分感谢 实现一个贪吃蛇游戏需要几步? 1.有地图 2.有蛇 3.有食物 ...

  2. jetbrains全系列可用2018

    转自 https://blog.csdn.net/u014044812/article/details/78727496 仅记录前两种方法 1.授权服务器激活 优点:方便快捷 缺点:激活的人数多了就容 ...

  3. 关于MySQL的经典例题50道

    --1.学生表Student(S,Sname,Sage,Ssex) --S 学生编号,Sname 学生姓名,Sage 出生年月,Ssex 学生性别--2.课程表 Course(C,Cname,T) - ...

  4. node 利用命令行交互生成相应模板

    目录 readline 实现 使用process实现 使用 inquirer 调用的生成模板方法 (generator 方法) 创建时间:2019-10-15 测试环境:win10 node-v10. ...

  5. 一篇文章教会你jQuery应用

    一 认识jQuery jQuery是JavaScript Query的缩写形式.jQuery是一款非常优秀的JavaScript库,即便是MVVM框架盛行的今天,也有超过半数的网页及应用直接或间接的使 ...

  6. kettle 利用 HTTP Client 获取猫眼电影API近期上映相关信息,并解析json

    前言 Kettle 除了常规的数据处理之外,还可以模拟发送HTTP client/post ,REST client. 实验背景 这周二老师布置了一项实验: 建立一个转换,实现一个猫眼API热映电影的 ...

  7. Selenium+PhantomJS使用时报错原因

    运行下面代码:'''PhantomJS运用''' from selenium import webdriverimport time # 通过keys模拟键盘from selenium.webdriv ...

  8. dubbo配置文件的加载顺序详解(图示)

    Dubbo配置文件的加载顺序 ​ 在使用apache dubbo.version2.7.3 时,配置文件的加载情况.以provider提供服务者为例. 配置文件 ,以下四个配置文件. 其优先级 app ...

  9. 打造属于自己的 HTML/CSS/JavaScript 实时编辑器

    转载请注明出处:葡萄城官网,葡萄城为开发者提供专业的开发工具.解决方案和服务,赋能开发者.原文出处:https://blog.bitsrc.io/build-an-html-css-js-playgr ...

  10. Echart:前端很好的数据图表展现工具+demo

    官网:  http://echarts.baidu.com/index.html 通过一个简单的小Demo介绍echart的使用:demo均亲测可以运行 demo1: 1.新建一个echarts.ht ...