c语言第四章程序控制结构.pptVIP

  • 10
  • 0
  • 约8.95千字
  • 约 49页
  • 2017-09-07 发布于河南
  • 举报
c语言第四章程序控制结构

第4章 程序的控制结构 (简洁版) Flowchart: Calculate the Minimum C Program: Calculate the Minimum if Statement 例4.5 :体型判断 按“体指数”对肥胖程度进行划分: 体指数t = w / h2 (体重w单位为公斤,身高h单位为米) 当t 18时,为低体重; 当18 ≤ t 25时,为正常体重; 当25 t 27时,为超重体重; 当t ≥ 27时,为肥胖。 编程从键盘输入你的身高h和体重w,判断你的体重属于何种类型。 例4.5 #include stdio.h main() { float h, w, t; printf(Please enter h,w:); scanf(%f, %f, h, w); t = w / (h * h); if (t 18) printf(t=%f\tLower weight!\n, t); else if (t 25) printf(t=%f\tStandard weight!\n, t); else if (t 27) printf(t=%f\tHigher weight!\n, t); else printf(t=%f\tToo fat

文档评论(0)

1亿VIP精品文档

相关文档