You're printing one digit at a time. You need to calculate the first term by multiplying it by 10 and adding the third term + 1 each time thorugh the loop.
1 2 3 4 5 6 7 8 9 10 11 12 13
#include <stdio.h>
#include <cstdlib>
int main (void)
{ int t1=9, t2=9, t3, x;
for (t3=7; t3>=0; t3--)
{ x = t1 * t2 + t3;
printf("%9d * %d + %d = %d\n", t1, t2, t3, x);
t1 = t1 * 10 + (t3+1);
}
system ("pause");
}
for ( int i = 7, x = 0; i >= 0; i-- )
{
constint N = 9;
constint base = 10;
x = base * x + N + i - 7;
std::cout << std::setw( i ) << "" << x << '*' << N << '+' << i << '=' << x * N + i << std::endl;
}
The following is a small/simple equation to outline this.
a*b+c = d;
Observations:
a: Each digit value is one less than the preceding digit.
b: Always equal to 9
c: Always decremented by one per line
d: All digits are always 8. Each following line has one more digit than the previous.
Try to take it from here. I'd give you more help, but I'm not sure if you mean that you need to mathematically do the calculations, or if you just need to make a function which outputs the given text.