N/APosted on - 11/02/2012
What is the minimum number of printf() statements that could be used to print table1?
Why would you not write a program using the minimum number of printf() function calls?
Part no. Price
T1267 USD 6.34
T1300 USD 8.92
T3401 USD 65.40
T4482 USD 36.99
Printf() Minimum Number on Print Table 1 in C Programming
Your table 1 has four lines and a heading. In order to print table 1 (not include heading), you have four printf() statements. But, if you use a loop statement (for, while, or do…while), you have just one printf() statement, and the program will call it x times, depends on number of lines in your table.
void Print Price(Table1 tb, int numOfLine)
printf(“Part No tt Pricen”);
for(id=0; id<numOfLine; id++)
printf(“%s t USD t %.2f n”, tb[id].partNo, tb[id].price);
Hope this helps