|
#include <stdio.h>
int main ()
{
int i, j;
long int f1, f2, sum = 0;
for (i = 1; i <= 9; i ++)
{
f1 = i;
sum = 0;
printf ("sum =");
for (j = 1; j <= 9; j ++)
{
f2 = f1 * 10 + i;
sum + = f1;
if (j == 9) printf ("% ld =", f1);
else printf ("% ld +", f1);
f1 = f2;
}
printf ("% ld\n", sum);
}
return 0;
}
Improved, that is, all the numbers are output using ld long shaping |
|