Originally Posted by
blisman20
Thank you, that fixed my error. I will be sure to post more appropriately in the future, but I don't understand what you mean when you say copy the indentation too. If you could please explain that because when I copy and paste my code, I do not get any syntax highlighting. Thank you!
What I mean is, make sure when you copy-paste, you actually copy your program with indentation. Depending on your editor/IDE settings, you may use tabs instead of spaces, or have some other setting that effectively removes the indentation when you paste into the editor window. Basically, your code looks like this:
Code:
#include <stdio.h>
#include <math.h>
int main(void)
{
int x,polynomial;
printf ( "Please input an interger value for x: ");
scanf ( "%d", &x);
polynomial = pow (x,5) - 5 pow (x,4) + 10 pow (x,3) - 10 pow (x,2) + 5 pow(x,1) + 1;
printf ( "The value for the polynomial of x = %d is: %d\n", x, polynomial);
return 0;
}
but it should look like this:
Code:
#include <stdio.h>
#include <math.h>
int main(void)
{
int x,polynomial;
printf ( "Please input an interger value for x: ");
scanf ( "%d", &x);
polynomial = pow (x,5) - 5 pow (x,4) + 10 pow (x,3) - 10 pow (x,2) + 5 pow(x,1) + 1;
printf ( "The value for the polynomial of x = %d is: %d\n", x, polynomial);
// imagine you had an if statement like the following
if (print_indent_line) {
printf("this line of code should be more indented because it is subordinate to the if statement\n");
}
return 0;
}