blob: d249dca67199d82349757d8beb4eab788b092b0c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
/*File: nestedloop.c
Make a multiplication table useing 2 nested loops
*/
#include <stdio.h>
int main()
{
int x, y;
printf("xxx %-3i %-3i %-3i %-3i %-3i %-3i %-3i %-3i %-3i %-3i\n",1,2,3,4,5,6,7,8,9,10);
printf("------------------------------------------\n");
for(x=1;x<=10;x++)
{
printf("%-3i|",x);
for(y=1;y<=x;y++)
{
printf("%-3i ",x*y);
}
printf("\n");
}
printf("------------------------------------------\n");
return 0;
}
|