1、20021 程序填空,不要改变与输入输出有关的语句。输入一个正整数 repeat (0int main(void)int repeat, ri;double x, y; scanf(“%d“, for(ri = 1; ri int main(void)int celsius, fahr; /*-*/scanf(“%d”,celsius=5.0*(fahr-32)/9;printf(“celsius = %dn“, celsius);20023 程序填空,不要改变与输入输出有关的语句。输入存款金额 money、存期 year 和年利率 rate,根据下列公式计算存款到期时的利息 interest
2、(税前) ,输出时保留 2 位小数。interest = money(1+rate)year - money输入输出示例:括号内为说明输入1000 3 0.025 (money = 1000, year = 3, rate = 0.025)输出interest = 76.89#include #include int main(void)int money, year;double interest, rate;/*-*/scanf(“%d%d%lf”,interest=money*pow(1+rate),year)-money;printf(“interest = %.2fn“, inter
3、est);20024 程序填空,不要改变与输入输出有关的语句。输入一个正整数 repeat (0= 0 时,f(x) = x0.5,当 x 小于 0 时,f(x) = (x+1)2 + 2x + 1/x。输入输出示例:括号内是说明输入3 (repeat=3)10-0.50输出f(10.00) = 3.16f(-0.50) = -2.75f(0.00) = 0.00#include #include int main(void)int repeat, ri;double x, y;scanf(“%d“, for(ri = 1; ri =0) y=sqrt(x);else y=pow(x+1),2
4、)+2*x+1/x;printf(“f(%.2f) = %.2fn“, x, y); 20025 程序填空,不要改变与输入输出有关的语句。输入一个正整数 repeat (0int main(void)int repeat, ri;double x, y;scanf(“%d“, for(ri = 1; ri int main(void)int num1, num2; /*-*/scanf(“%d%d“, printf(“%d + %d = %dn“, num1, num2, num1+num2);printf(“%d - %d = %dn“, num1, num2, num1-num2);pri
5、ntf(“%d * %d = %dn“, num1, num2, num1*num2);printf(“%d / %d = %dn“, num1, num2, num1/num2);printf(“%d % %d = %dn“, num1, num2, num1%num2);return 0;20031 程序填空,不要改变与输入输出有关的语句。计算表达式 1 + 2 + 3 + + 100 的值。输出示例:sum = 5050#include int main(void) int i, sum;/*-*/sum=0;for(i=1;iint main(void) int i, m, sum;i
6、nt repeat, ri;scanf(“%d“, for(ri = 1; ri int main(void) int i, m, n;int repeat, ri;double sum;scanf(“%d“, for(ri = 1; ri int main(void) int i, n;int repeat, ri;double sum;scanf(“%d“, for(ri = 1; ri int main(void)int flag, i, n, t;int repeat, ri;double item, sum;scanf(“%d“, for(ri = 1; ri int main(vo
7、id) int lower, upper;int repeat, ri;double celsius, fahr; scanf(“%d“, for(ri = 1; ri int main(void)int i, n;int repeat, ri;double mypow, x;scanf(“%d“, for(ri = 1; ri #include int main(void)int i, n;double mypow;scanf(“%d“, /*-*/for(i=0;iint main(void)int i, n;double myfact;double fact(int n);scanf(“
8、%d“, /*-*/for(i=1;i#include int main(void)int i;double sum;/*-*/sum=0;for(i=100;i#include int main(void)int repeat, ri;double a, b, c, d;scanf(“%d“, for(ri = 1; ri =0)printf(“x1 = %0.2fn“, (-b+sqrt(d)/(2*a);printf(“x2 = %0.2fn“, (-b-sqrt(d)/(2*a);else printf(“x1 = %0.2f+%0.2fin“, -b/(2*a), sqrt(-d)/
9、(2*a);printf(“x2 = %0.2f-%0.2fin“, -b/(2*a), sqrt(-d)/(2*a); 30002 程序填空,不要改变与输入输出有关的语句。输入一个正整数 repeat (0 0输入输出示例:括号内是说明输入3 (repeat=3)10 (x=10)0 (x=0)-98 (x=-98)输出sign(10) = 1 (x = 10 时 y = 1)sign(0) = 0 (x = 0 时 y = 0)sign(-98) = -1 (x = -98 时 y = -1)#include int main(void)int repeat, ri;int x, y;sc
10、anf(“%d“, for(ri = 1; ri 0) y=1;else if(x=0) y=0;else y=-1;printf(“sign(%d) = %dn“, x, y);return 0;30003 程序填空,不要改变与输入输出有关的语句。输入 10 个字符,统计其中英文字母、空格或回车、数字字符和其他字符的个数。输入输出示例:括号内是说明输入Reold 123?输出letter = 5, blank = 1, digit = 3, other = 1#include int main(void)char c;int blank, digit, i, letter, other;blank = digit = letter = other = 0; for(i = 1; i = a int repeat, ri;scanf(“%d“, for(ri = 1; ri int main(void)int choice, i;double price;for(i = 1; i int main(void)int i, mark;