From ffc3f7c25c9729c8e7f87f3fdbbbae4ff8c9f0a1 Mon Sep 17 00:00:00 2001 From: taqqisarra <147220821+taqqisarra@users.noreply.github.com> Date: Sun, 22 Oct 2023 04:26:09 -0700 Subject: [PATCH] Update multTable.c --- src/multTable.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/multTable.c b/src/multTable.c index 6958c13..d7f98ce 100755 --- a/src/multTable.c +++ b/src/multTable.c @@ -1,27 +1,31 @@ -/** - * Author: - * Date: - * - * This program generates a multiplication table - * of the size given as a command line argument. - */ #include #include -int main(int argc, char **argv) { - - if(argc != 2) { +int main(int argc, char **argv) +{ + if (argc != 2) { printf("Error: provide an integer\n"); exit(1); } - int n = atoi(argv[1]); - if(n <= 0) { - printf("empty table!\n"); + int n = atoi(argv[1); + if (n <= 0) { + printf("Empty table!\n"); exit(0); } - //TODO: place your code here + for (int i = 1; i <= n; i++) { + for (int j = 1; j <= n; j++) { + printf("%4d", i * j); + } + printf("\n"); + } return 0; -} \ No newline at end of file +} + + + + + +