Question
October 31, 2008 at 08:40 AM
galandracos

programming help

by galandracos . Updated 17 years, 10 months ago

ned help I made a program (multiplication table) but when i read the requirements it doesnt meet any and i don’t know how to change it
REquirements
? In your mainline, using a loop (loop #1) walk through the numbers 1 to 9 inclusive
? Write a function called timetable() which takes the array as a parameter, and the index of loop #1 as a parameter
o In this function, using another loop (loop #2) again walk through the numbers 1 to 9 inclusive
o In writing the main() and timetable() this way, loop #2 is to be nested inside loop #1
o Within loop #2, store the answer of the index of loop #1 (passed in as a parameter) multiplies by the index of loop #2
? Back in the main() function, after returning from timesTable() but still inside loop #1, output the results of this ?times table?

code:
#include

int timeTable( int n );

void main()
{
printf(“times table for 1 \n “);
timeTable(1);
printf(“times table for 2 \n “);
timeTable(2);
printf(“times table for 3 \n “);
timeTable(3);
printf(“times table for 4 \n “);
timeTable(4);
printf(“times table for 5 \n “);
timeTable(5);
printf(“times table for 6\n “);
timeTable(6);
printf(“times table for 7\n “);
timeTable(7);
printf(“times table for 8\n “);
timeTable(8);
printf(“times table for 9\n “);
timeTable(9);

}

int timeTable( int n)
{
int answer;
for (answer=1; answer<10; answer++) printf("%i X %i = %i\n", answer,n,answer*n); return answer; } how do I change it!

This discussion is locked

All Comments