练习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. Python攻破淘宝网各类反爬手段,采集淘宝网ZDB(女用)的销量!

    声明: 由于某些原因,我这里会用手机代替,其实是一样的! 环境: windows python3.6.5 模块: time selenium re 环境与模块介绍完毕后,就可以来实行我们的操作了. 第 ...

  2. Cocos Creator 3D 打砖块图文教程(一)

    在线体验链接: http://example.creator-star.cn/block3d/ 上面图中是打砖块游戏的主要 3D 节点元素,Shawn 这两天在学习 Unity 与 Creator3D ...

  3. PHP 微信机器人 Vbot 结合 Laravel 基础入门及实例

    新来了项目,需要能监听指定微信群的消息并进行转发.基于 PHP 7 的 web 微信机器人 Vbot 可以满足需求.Vbot 本质上就是实现了登录网页版微信来进行自动回复.群管理等等操作. githu ...

  4. Java匹马行天下之教你用学汉语式方法学编程语言

    Java匹马行天下之教你用学汉语式方法学编程语言 前言: 前段时间接连更新了带小白从入门到了解的几篇博客: <Java匹马行天下之编程常识知多少> <Java匹马行天下之走进编程的殿 ...

  5. jQuery插件编写学习中遇见的问题--attr prop

    个人博客: https://chenjiahao.xyz 最近在学习jQuery的插件的编写,有两种方式,$.fn.extend以及$.extend,一种是作用于对象原型上,一种是直接作用于jQuer ...

  6. python 中的一点新知识

    逻辑行与物理行 所谓物理行(Physical Line)是你在编写程序时 你所看到 的内容.所谓逻辑行(Logical Line)是 Python 所看到 的单个语句.Python 会假定每一 物理行 ...

  7. MVC ValidationAttribute 验证一个字段必须大于另一个字段

    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)] pu ...

  8. 那些你不知道的HTML知识,快来学习一下吧

    前言 HTML作为前端三大基础知识点之一,是每一个前端开发人员都要掌握的部分.今天这篇文章我们来看看一些平时不太会注意,却在面试时可能会问到的题目,来看看你都会吗? 如何使用div模拟实现textar ...

  9. 机器学习:IB1算法的weka源码详细解析(1NN)

    机器学习的1NN最近邻算法,在weka里叫IB1,是因为Instance Base  1 ,也就是只基于一个最近邻的实例的惰性学习算法. 下面总结一下,weka中对IB1源码的学习总结. 首先需要把 ...

  10. 超级好用的 Java 数据可视化库:Tablesaw

    本文适合刚学习完 Java 语言基础的人群,跟着本文可了解和使用 Tablesaw 项目.示例均在 Windows 操作系统下演示 本文作者:HelloGitHub-秦人 HelloGitHub 推出 ...