Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

y=3x^3-5X^2+6 bUT IT WON'T RUN. pLEASE HELP...

+1 vote
asked Sep 21, 2019 by anonymous

#include<stdio.h>

int main()

{

int x;

setbuf(stdout,NULL);

printf("Enter x: \n");

scanf("%d\n",&x);

printf("You entered x: %d", x);

printf("y=%d\n",(3*x*x*x)-(5*x*x)+6);

return 0;

}

7 Answers

0 votes
answered Sep 21, 2019 by G Abhijit
#include<stdio.h>
#include<math.h>

int main()

{

int x;
printf("Enter x: \n");

scanf("%d",&x);

printf("You entered x: %d", x);

printf("\ny= %d",(3*x*x*x)-(5*x*x)+6);

return 0;

}
0 votes
answered Sep 21, 2019 by anonymous

#include<stdio.h>

int main()

{

int x;

setbuf(stdout,NULL);

printf("Enter x: \n");

scanf("%d",&x);

printf("You entered x: %d", x);

printf("y=%d\n",(3*x*x*x)-(5*x*x)+6);

return 0;

}

dont write '\n' in scanf function

0 votes
answered Sep 21, 2019 by anonymous
the value of the expression is y=3*x^3-5*x^2+6 and setbuf function call is not required
0 votes
answered Sep 23, 2019 by anonymous
Remove \n in scanf since that is stopping scanf from terminating properly
0 votes
answered Oct 3, 2019 by Uzair Anwar (360 points)
Bro you just add math.h library

or cmath in it should be true when you use power function or ^
0 votes
answered Oct 3, 2019 by anonymous
#include<stdio.h>

int main()

{
int x;
printf("Enter x: \n");
scanf("%d",&x);
printf("You entered x: %d", x);
float f=3*(x*x*x)-(5*(x*x))+6;
printf("y=%f\n",f);
return 0;
}
0 votes
answered Oct 4, 2019 by anonymous
#include<stdio.h>

int main()

{

int x;

printf("Enter x: \n");

scanf("%d",&x);

printf("You entered x: %d\n", x);

printf("y=%d\n",(3*x*x*x)-(5*x*x)+6);

return 0;

}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...