C语言题库(编程)河南工业大学 河工大 c语言期末考试题库(国外英语资料).doc

C语言题库(编程)河南工业大学 河工大 c语言期末考试题库(国外英语资料).doc

  1. 1、本文档共51页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
C语言题库(编程)河南工业大学 河工大 c语言期末考试题库(国外英语资料)

C语言题库(编程)河南工业大学 河工大 c语言期末考试题库(国外英语资料) Two, programming problems 1., there is a function: when x0, y=-1; when x=0, y=0; when x0, y=1. Make a program, enter the value of X, output the value of Y. #includestdio.h Void, main () { Int, x, y; Printf (enter x:); Scanf (%d, x); If (x0) Y=-1; Else if (x=0) Y=0; Else Y=1; Printf (y=%d, y); } 2. enter three real numbers, arrange these three numbers in large to small order, and output these three numbers. #includestdio.h Void, main () {int, a, B, C, temp=0; Printf (please, input, a, B, c:); Scanf (%d,%d,%d, a, b, c); If (ab) {temp=a; a=b; b=temp;} If (ac) {temp=a; a=c; c=temp;} If (bc) {temp=b; b=c; c=temp;} Printf (from big to small:%d,%d,%d\n, a, B, C); } 3., there are three integers a, B, C, the keyboard input, output the largest. Void, main () { Int, a, B, C, max; Printf (enter three numbers: \n); Scanf (%d%d%d, a, b, c); If (abac) Max=a; If (babc) Max=b; If (cacb) Max=c; Printf (the maximum value is:%d\n, Max); } 4. programming for round area, circle circumference. The radius of the circle is required to be input by the keyboard, and the output should be written with two digits after the decimal point. #includestdio.h #define PI 3.1416 (main) { Float, R, l, s; Printf (enter radius: \n); Scanf (%f, r); L=2*pi*r; S=pi*r*r; Printf (l=%7.2f\ns=%7.2f\n, L, s); } 5. [] is a bit difficult to piecewise function: when x-10, y=|x|+5; when -10 = x = 10, y=4x-8; when x10, y=sqrt (x). Make a program, enter the value of X, output the value of Y. 6. write programs to determine whether a year is a leap year. The condition for leap year is that it can be divisible by 4, but can not be divisible by 100 or can be divisible by 400 #include stdio.h Int, main () { Int, year, leap; Scanf (%d, year); If (year%4==0) { If (year%100==0) { If (year%400==0) Leap=1; Else Leap=0; } Else Leap=1; } Else Leap=0; If (LEAP) Printf (%d is, year); Else Printf (%d is not, year); Printf (a leap year.\n); Return 0; } 7. enter a Fahrenheit temperature, require out

文档评论(0)

f8r9t5c + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:8000054077000003

1亿VIP精品文档

相关文档