#每日一练-1#

来源:互联网 发布:linux 进入文件夹 编辑:程序博客网 时间:2024/04/28 22:25
#include <stdio.h>#if 0 //test 1void main(void){int input;char output1;//char output2;printf("please input ASCII symbol:");scanf("%d",&input);output1=(char)input;//output2='input';printf("output1=%c\n",output1);}int main(void){    int ascii;        printf("Enter an ASCII code: ");    scanf("%d", &ascii);    printf("%d is the ASCII code for %c.\n", ascii, ascii);    return 0;}#endif#if 0 //test2int main(void){float f_number;printf("Enter an float number: ");scanf("%f",&f_number);printf("The input is %f or %e.\n", f_number,f_number);}#endif#if 0 // test3int main(void){float water_kt;float water_weight;float water_molecule;printf("Enter water weight: ");scanf("%f",&water_kt);water_weight=water_kt*950;water_molecule=water_weight/3.0e-23;printf("the number of water molecule is %e\n",water_molecule);}#endifint main(void){    float mass_mol = 3.0e-23;   /* mass of water molecule in grams */    float mass_qt = 950;        /* mass of quart of water in grams */    float quarts;    float molecules;        printf("Enter the number of quarts of water: ");    scanf("%f", &quarts);    molecules = quarts * mass_qt / mass_mol;    printf("%f quarts of water contain %e molecules.\n", quarts,            molecules);    return 0;}

0 0
原创粉丝点击