1026: C语言程序设计教程(第三版)课后习题7.5

题目描述

输入10个数字,然后逆序输出。

输入

十个整数

输出

逆序输出,空格分开

样例输入

1 2 3 4 5 6 7 8 9 0

样例输出

0 9 8 7 6 5 4 3 2 1


 1 #include <stdio.h>
 2 
 3 int main(int argc, char const *argv[])
 4 {
 5     int a[10], i;
 6 
 7     // input
 8     for(i = 0; i < 10; i++)
 9     {
10         scanf("%d", &a[i]);
11     }
12 
13     // output
14     for(i = 9; i >= 0; i--)
15     {
16         if(i == 9)
17             printf("%d", a[i]);
18         else
19             printf(" %d", a[i]);
20     }
21     return 0;
22 }

 

转载于:https://www.cnblogs.com/hello-lijj/p/7851022.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
程序设计技术》(第三版习题参考答案 习题1 一、单项选择题 DADDD BDCCD 二、填空题 ① 主 ② main ③ x=x*(x+b) ④ 普通、格式、分隔和转义 ⑤ 指定输出数据格式 ⑥ void main() ⑦ "how are you! " 三、阅读程序题 1. 9,11,9,10 2. 2,-1,-2 3. aa bb cc abc A 6 4. 2,2 5. 57 5 7 67.5864000,-789.124023 67.5864000, -7.89e+002 67,86, -789.12,67.5864000, -789.124023, 67.5864000, -789.124023 6.758640e+001, -7.89e+002 A,65,101,41 1234567,4553207,12d687 65535,177777,ffff,65535 COMPUTER, COM. 6. a + c = 102 a + c = f f + m = 17.950000 a + m = 17.650000 c + f = 102.300000 double = 1746.150019 四、程序设计题 //xt010401.cpp #include <stdio.h> #define PI 3.1415926 void main() { double r,h; printf("请输入半径r和高h:"); scanf("%lf,%lf",&r,&h); printf("圆半径: %lf\n",2*PI*r); printf("圆面积:%lf\n",PI*r*r); printf("圆球表面积:%lf\n",4*PI*r*r); printf("圆球体积:%lf\n",4.0/3*PI*r*r); printf("圆柱体积:%lf\n",PI*r*r*h); } //xt010402.cpp #include <stdio.h> void main() { int c; printf("Input a character:"); c=getchar(); printf("%c\t%d\n",c,c); } //xt010403.cpp #include <stdio.h> void main() { int x,y,h=30,f=90; x=(4*h-f)/2; y=(f-2*h)/2; printf("鸡:%d, 兔:%d\n",x,y); } //xt010404.cpp #include <stdio.h> #include <math.h> void main() { double a,b,c,s,area; printf("请输入三角形的三条边长(注意三条边长应能够构成三角形):"); scanf("%lf,%lf,%lf",&a,&b,&c); s=(a+b+c)/2; area=sqrt(s*(s-a)*(s-b)*(s-c)); printf("三角形的面积是: %lf\n",area); } //xt010405.cpp #include <stdio.h> void main() { double f,c; printf("请输入华氏温度:");
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值