initial import
[staff/goc4/2018bti7061.git] / c-6-additional / examples / c-variousexamples / commandlinemultiply.c
1 #include <stdio.h>
2
3 int main(int argc,char* argv[]){
4
5 if(argc!=3)
6 goto error;
7 int val1,val2;
8
9 int res1=sscanf(argv[1]," %d",&val1);
10 int res2=sscanf(argv[2]," %d",&val2);
11
12 if(res1!=1 || res2!=1)
13 goto error;
14
15 printf("%d x %d = %d\n",val1,val2,val1*val2);
16
17 return 0;
18 error:
19 printf("Usage:\n commandlinemultiply <num1> <num2>\n");
20 return 1;
21
22 }