racunalo3.c | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include <stdio.h> #include <stdlib.h> #include <string.h> int stevilka(char *s) { int i = 0, x=0; while (i<strlen(s)) { x = 10*x + (s[i++]-'0'); } return x; } main(int argc, char *argv[]) { // namesto int x = atoi(argv[1]); int x=stevilka(argv[1]); // namesto int y = atoi(argv[2]); int y=stevilka(argv[2]); printf("%d + %d = %d\n", x, y, x+y); } |