c语言小程序练习.docVIP

  • 8
  • 0
  • 约2.64千字
  • 约 4页
  • 2017-06-12 发布于北京
  • 举报
从键盘上输入两个整数,求出它们的和#includestdio.h void main() { int x,y,s; scanf(%d,%d,%d,x,y,s); if(s==x+y) 是==不是= printf(yes); else printf(wrong); } 已知三角形的底和高,求出三角形的面积。#includestdio.h void main() { int x,y; float s; scanf(%d,%d,x,y); s=x*y/2; 不能写成1/2*x*y printf(%f,s); } 输入3,5输出7.000000 #includestdio.h void main() { float s,x,y; scanf(%f,%f,x,y); s=x*y/2; printf(%f\n,s); } 输入3,5输出7.500000 已知三角形的三边长,求出三角形的面积。#includestdio.h #includemath.h void main() { float a,b,c,p,s; scanf(%f,%f,%f,a,b,c); p=(a+b+c)/2; s=sqrt(p*(p-a)*(p-b)*(p-c)); printf(%f,s); } 已知二元一次方程的三个系数,求方程的一个根。. 编

文档评论(0)

1亿VIP精品文档

相关文档