#include <stdio.h> #include <math.h> int main() { int n; int res; res = scanf("%d", &n); int array[n][2]; for (int i = 0; i < n; i++) { res = scanf("%d %d", &array[i][0], &array[i][1]); if (res==EOF){ printf("input height or weight something wrong"); } // 输入身高和体重(市斤) } for (int i = 0; i < n; i++) { int h, w; h = array[i][0]; w = array[i][1]; double standard_w = (h - 100) * 0.9*2; // 计算标准体重(公斤) double error = fabs(w - standard_w) / standard_w; // 计算误差 if (error < 0.1) { // 判断是否完美身材 printf("You are wan mei!\n"); } else if (w > standard_w) { // 判断是否太胖 printf("You are tai pang le!\n"); } else { // 否则为太瘦 printf("You are tai shou le!\n"); } } return 0; }
c语言编程练习题:7-40 到底是不是太胖了
作者:yunjinqi
类别:编程
日期:2023-05-29 14:20:18
阅读:610 次
消耗积分:0 分
版权所有,转载本站文章请注明出处:云子量化, https://www.yunjinqi.top/article/165
最新文章
系统当前共有 404 篇文章