ZKX's LAB

编写程序,从键盘输入x的值,按要求计算并输出y的值,当x的值≥0时,y=6x+5;当x的值<0时,y=5x-3 从键盘输入x值求y的值并输出

2021-04-09知识4

编写一个程序,功能是从键盘输入两个数x,y,求x的y次方的值,输出结果 #includeincludeincludeint main(void){int x,y,power=1;int i;printf(\"请输入x:\");scanf(\"%d\",&x);printf(\"请输入y:\");scanf(\"%d\",&y);putchar('\\n');for(i=0;i;i+)power*=x;printf(\"x的y次方:%d\\n\",power);putchar('\\n');getch();屏幕暂留*/return 0;}运行结果

c语言题目编一个程序,输入X的值,按下列公式计算并输出Y的值 #includeint main(){int x,y;printf(\"输入x的值:\");scanf(\"%d\",&x);if(x)y=x;else if(x>;1&x)y=2*x-1;else if(x>;=10)y=3*x-11;printf(\"y=d\\n\",y);return 0;}

编写程序,要求从键盘输入x的值,输出y的值。 #includedouble f(double x){if(x>;=-5&x。1)return 1.0/(x+1);if(x>;=0&x)return 1.0/(x+2.0)/(x+2.0);if(x>;=5&x)return 1.0/(x+4.0)/(x+4.0)/(x+4.0);}int main(){double x,y;scanf(\"%lf\",&x);printf(\"y=g\\n\",f(x));return 0;}

随机阅读

qrcode
访问手机版