diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2017-02-06 11:26:44 -0500 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2017-02-06 11:26:44 -0500 |
| commit | 97a693d996c79fb2a008b19750d8bb45512e01a2 (patch) | |
| tree | 6df17bfe7de7c59f7b1083828d71a91e61fae9fa /nestedloop.c | |
| download | engr0016-97a693d996c79fb2a008b19750d8bb45512e01a2.tar.gz engr0016-97a693d996c79fb2a008b19750d8bb45512e01a2.tar.bz2 engr0016-97a693d996c79fb2a008b19750d8bb45512e01a2.zip | |
Diffstat (limited to 'nestedloop.c')
| -rw-r--r-- | nestedloop.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/nestedloop.c b/nestedloop.c new file mode 100644 index 0000000..d249dca --- /dev/null +++ b/nestedloop.c @@ -0,0 +1,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; +} |
