阿尔法编程python答案_C语言程序设计-阿尔法编程(编程答案)

{

int putin,total,jo=50,yo=42,jafter=0,gavey=0;

scanf("%d",&putin);

total=putin+jo+yo;

jafter=(float)total/2;

gavey=jafter-yo;

printf("%d",gavey);

return 0;

}

计算盐水浓度

#include &ltstdio.h&gt

int main() {

float nacl,water=95,jd;

scanf("%f",&nacl);

jd=nacl/(nacl+water);

printf("%0.2f",jd);

return 0;

}

计算最佳观看距离

#include &ltstdio.h&gt

int main() {

float height,pix,jl;

scanf("%f %f",&height,&pix);

jl=height/pix*3400;

printf("%0.2f",jl);

return 0;

}

判断大小月

#include &ltstdio.h&gt

int main () {

// TODO 请在此处编写代码,完成题目要求

int i;

scanf("%d",&i);

if(i&gt0&&i&lt13)

if(2==i||4==i||6==i||9==i||11==i)

printf("lunar month");

else

printf("solar month");

else

{

printf("error");

}

return 0;

}

判断正负数

#include &ltstdio.h&gt

int main () {

// TODO 请在此处编写代码,完成题目要求

int i;

scanf("%d",&i);

if(0!=i)

if(i&gt0)

printf("positive");

else

printf("negative");

else

{

printf("zero");

}

return 0;

}

判断回文数

#include &ltstdio.h&gt

int ishuiwen(int i)

{

int g,s,q,w;

g=i%10;

w=i/10000;

q=i/1000%10;

s=i/10%10;

return g==w&&s==q;

}

int main () {

// TODO 请在此处编写代码,完成题目要求

int i;

scanf("%d",&i);

if(ishuiwen(i))

printf("yes");

else

printf("no");

return 0;

}

判断元辅音

#include &ltstdio.h&gt

int main () {

// TODO 请在此处编写代码,完成题目要求

char i;

scanf("%c",&i);

if(i=='a'||i=='e'||i=='i'||i=='o'||i=='u')

printf("vowel sound");

else

printf("consonant sound");

return 0;

}

时间差

#include &ltstdio.h&gt

struct TIME

{

int seconds;

int minutes;

int hours;

};

void differenceBetweenTimePeriod(struct TIME t1, struct TIME t2, struct TIME *diff);

int main()

{

struct TIME startTime, stopTime, diff;

startTime.seconds=0;

stopTime.seconds=0;

scanf("%d:%d %d:%d", &startTime.hours, &startTime.minutes, &stopTime.hours, &stopTime.minutes);

// 计算差值

differenceBetweenTimePeriod( stopTime,startTime, &diff);

printf("%d:%d\n", diff.hours, diff.minutes);

return 0;

}

void differenceBetweenTimePeriod(struct TIME start, struct TIME stop, struct TIME *diff)

{

if(stop.seconds &gt start.seconds){

--start.minutes;

start.seconds += 60;

}

diff-&gtseconds = start.seconds - stop.seconds;

if(stop.minutes &gt start.minutes){

--start.hours;

start.minutes += 60;

}

diff-&gtminutes = start.minutes - stop.minutes;

d

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值