编程知识 cdmana.com

I wrote a program with if statement. Can you help me see why it can't run?

#include<stdio.h>
int main(void)
{
float x,y;

scanf("%f",x);if(x<1){    y=x;    printf("y=%f\n",y);}else if(x>=1&&x<10){    y=2*x-1;    printf("y=%f\n",y);}else {    y=3*x-11;    printf("y=%f\n",y);}return 0;

}




Refer to the answer 1:

scanf("%f",&x);

#include<stdio.h>int main(void){float x,y;scanf("%f",&x);if(x<1){    y=x;    printf("y=%f\n",y);}else if(x>=1&&x<10){    y=2*x-1;    printf("y=%f\n",y);}else {    y=3*x-11;    printf("y=%f\n",y);}      return 0;}



Refer to the answer 2:



Refer to the answer 3:

scanf("%f", &x);
& Don't forget




Refer to the answer 4:

版权声明
本文为[CSDN Q & A]所创,转载请带上原文链接,感谢
https://cdmana.com/2021/11/20211123194108985l.html

Scroll to Top