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 +} + + + + + +