I made a program to do binomial expansion, but when I print the answer, it prints things like: 1x^3, 3x^0, 2x + -1 etc.
I tried to use sprintf to get the whole expansion in a string, but for some reason when I print the string at the end, I get something like this:
é é é é é 32
That was the output when I entered (3x+2)^5. I know the program works without sprintf, but I can't seem to get the whole expansion in a string. Here is the for loop that I'm using: