使用while循环计算多种尺寸的英尺长度

#include stdio.h#define ADJUST 7.31// one kind of symbolic constantint main(void){const double SCALE = 0.333;// another kind of symbolic constant

编程学习网为您整理以下代码实例,主要实现:使用while循环计算多种尺寸的英尺长度,希望可以帮到各位朋友。

#include <stdio.h>

#define ADJUST 7.31              // one kind of symbolic constant

int main(voID){
    const double SCALE = 0.333;  // another kind of symbolic constant
    double shoe, foot;
    shoe = 3.0;
    while (shoe < 18.5) {                        
        foot = SCALE * shoe + ADJUST;
        printf("%10.1f %15.2f inches\n", shoe, foot);
        shoe = shoe + 1.0;
    }                   
    printf("done.\n");

    return 0;
}
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐