c语言等级考试题易错,青岛科技大学c语言考试易错

学长亲身经历,热血打造

青岛科技大学C语言考试练习易错题

1、从键盘输入一个3位整数,将输出该数的逆序数。(实验指导书P89)

#include "stdio.h"

void main()

{

int a,b,c,x,y;

printf("enter a numbers:\n");

scanf("%d",&x);

a=x/100;

b=(x-a*100)/10;

c=x%10;

y=c*100+b*10+a;

printf("%d,%d",x,y);

}

2、输入三角形三条边的边长,求三角形的面积。(书P55)

#include "stdio.h"

#include "math.h"

void main()

{

double a,b,c,p,s;

printf("enter 3 numbers:\n");

scanf("%lf %lf %lf",&a,&b,&c);

p=(a+b+c)/2;

s=sqrt(p*(p-a)*(p-b)*(p-c));

printf("%lf",s);

}

3、输入3个字符型数据,将其转换成相应的整数后,求它们的平均值并输出 #include "stdio.h"

void main()

{

char a,b,c;

double d;

printf("enter:\n");

scanf("%c %c %c",&a,&b,&c);

d=(a+b+c)/3;

printf("%lf",d);

}

4、输入某一年月,输出该月的天数。(实验指导书P105)

#include "stdio.h"

void main()

{

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值