Basic C language algorithms-all are the sum of a's Series
/*
========================================================== ======================================
Question: The number of columns is a, aa, aaa ,....... A + aa + aaa + ...... + Aaaaaaa .......
========================================================== ======================================
*/
# Include
Main ()
{
Int a, I, n, x, Sn, flag = 1;
While (flag)
{
Printf (the last item is a few digits: n = );
Scanf (% d, & n );
Printf (a = );
Scanf (% d, & );
If (a> 0) & (a <10) & (n> 0) & (n <10 ))
Flag = 0;
Else
Printf (system prompt: both a and n must be a single-digit positive integer. Please try again! _________________________________);
X =;
Sn = x;
For (I = 1; I {
X = x * 10 +;
Sn + = x;
}
}
Printf (% d +... % d (% d) = % d, a, n, Sn );
}
/*
========================================================== ======================================
Rating: determine the number of digits of the last item. input parameter a to repeatedly assign values to the intermediate parameter x, and sum the values.
========================================================== ======================================
*/