练习2-1

 #include <stdio.h>

 int main() {
int x;
int y;
int percent; puts("请输入两个整数");
printf("整数x:");
scanf("%d", &x);
printf("整数y:");
scanf("%d", &y);
percent = (x * )/ y;
printf("x的值是y的%d%%", percent); return ;
}

练习2-2

 #include <stdio.h>

 int main() {
int x;
int y; puts("请输入两个整数");
printf("整数x:");
scanf("%d", &x);
printf("整数y:");
scanf("%d", &y);
printf("他们的和是%d,积是%d", x+y,x*y); return ;
}

练习2-3

 #include <stdio.h>

 int main() {
double x;
printf("请输入一个实数:");
scanf("%lf", &x);
printf("你输入的值是:%f", x);
return ;
}

练习2-4

练习2-5

 #include <stdio.h>

 int main() {
int x;
int y;
puts("请输入两个整数。");
printf("整数a:");
scanf("%d", &x);
printf("整数b:");
scanf("%d", &y);
printf("a是b的%f%%", (double)x / y * );
return ;
}

练习2-6

 #include <stdio.h>

 int main() {
int x;
printf("请输入你的身高:");
scanf("%d", &x);
printf("您的标准体重是:%.1f公斤", (x - ) * 0.9); return ;
}

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

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

    练习1-1 #include <stdio.h> int main() { int a; a = 15; int b; b = 37; int c; c = a - b; printf(& ...

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

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

  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语言 中级篇 第一章答案

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

  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语言 入门篇 第六章答案

    练习6-1 /* 求两个整数中的最小值 */ #include <stdio.h> /*--- 返回三个整数中的最小值 ---*/ int min2(int a, int b) { int ...

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

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

随机推荐

  1. Eureka实战-4【开启http basic权限认证】

    在我们实际生产环境中,都需要考虑到一个安全问题,比如用户登录,又或者是eureka server,它对外暴露的有自己的rest API,如果没有安全认证,也就意味着别人可以通过rest API随意修改 ...

  2. ELK 学习笔记之 Logstash之output配置

    Logstash之output配置: 输出到file 配置conf: input{ file{ path => "/usr/local/logstash-5.6.1/bin/spark ...

  3. 阿里云Centos操作Mysql

    1.  CentOS7 yum方式安装MySQL5.7 2.Centos下mysql导入sql 3.Centos设置远程 4.CentOS下mysql数据库常用命令总结 5.centos出现“Fire ...

  4. python程序设计基础(嵩天)第五章课后习题部分答案

    第五章p1515.2:实现isodd()函数,参数为整数,如果参数为奇数,返回true,否则返回false.def isodd(s): x=eval(s) if(x%2==0): return Fal ...

  5. spring boot参数验证

    必须要知道 简述 JSR303/JSR-349,hibernate validation,spring validation 之间的关系 JSR303 是一项标准,JSR-349 是其的升级版本,添加 ...

  6. bugku 很普通的数独

    下载下是一个没有后缀的文件,使用winhex打开,头文件为50 4b 03 为zip文件,修改后缀,打开压缩包,是一大堆数独图片. 仔细看了好久,发现这几张图片像二维码,而且1 5 21这三张图的位置 ...

  7. 阿里云 RDS 数据库又发 CPU 近 100% 的“芯脏病”

    最近云界发生了2件事,一件是大事,一件是小事,大事是阿里云与微软合作推出了开放应用模型 Open Application Model(OAM),小事是由于微软 SQL Server 在阿里云上水土不服 ...

  8. springboot依赖的一些配置:spring-boot-dependencies、spring-boot-starter-parent、io.spring.platform

    springboot里会引入很多springboot starter依赖,这些依赖的版本号统一管理,springboot有几种方案可以选择. 一.spring-boot-dependencies 有两 ...

  9. unittest中HTMLTestRunner模块生成

    unittest里面是不能生成html格式报告的,需要导入一个第三方的模块:HTMLTestRunner 一.导入HTMLTestRunner 方法1.这个模块下载不能通过pip安装了,只能下载后手动 ...

  10. Unix 线程共享创建进程打开的文件资源(1)

    执行环境:Linux ubuntu 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016 x86_64 x86_64 x86_64 ...