C语言 编程试及答案.docVIP

  • 38
  • 0
  • 约1.94万字
  • 约 21页
  • 2016-10-09 发布于贵州
  • 举报
C语言 编程试及答案

1编程:要求输入整数a和b,若a*a+b*b大于100,则输出a*a+b*b百位以上的数字,否则输出两数之和a+b。 #includestdio.h main() { int a,b,c; printf(please input a=); scanf(%d,a); printf(please input b=); scanf(%d,b); if(a*a+b*b100) { c=(a*a+b*b)/100; printf(%d,c); } else printf(%d\n,a+b); } 2编程:根据以下函数关系:当x=0,y=0;当0x=10,y=x;当10x=20,y=10;当x20,y=sin(x);输入一个x值,计算出相应的y值并输出。(提示:sin(x)属于math.h) #includestdio.h #includemath.h main() { int x; float y; printf(please input x=); scanf(%d,x); if(x=0) { y=0; } else if((0x)(x=10)) { y=x; } else if ((10x)(x=20)) { y=10; } else y=sin(x); printf(%f\n,y); } 3编程:根据以下函数关系:当xx=1,y=x;当1x=2,y=sqrt(x);当x2,y=

文档评论(0)

1亿VIP精品文档

相关文档