32 lines
610 B
C
32 lines
610 B
C
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <string.h>
|
||
|
int main(int argc, char const *argv[])
|
||
|
{
|
||
|
if (argc<=2)
|
||
|
{
|
||
|
printf("il manque des arguments. Il en faut 2, il y en a %d.\n",argc-1);
|
||
|
return 1;
|
||
|
}
|
||
|
for (int i = 0; i < strlen(argv[1]); ++i)
|
||
|
{
|
||
|
if(argv[1][i]=='.')
|
||
|
{
|
||
|
printf("Le premier argument n'est pas un reel.\n");
|
||
|
return 1;
|
||
|
}
|
||
|
}
|
||
|
for (int i = 0; i < strlen(argv[2]); ++i)
|
||
|
{
|
||
|
if(argv[2][i]=='.')
|
||
|
{
|
||
|
printf("Le deuxieme argument n'est pas un reel.\n");
|
||
|
return 1;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
long x = strtol(argv[1],NULL,10);
|
||
|
long y = strtol(argv[2],NULL,10);
|
||
|
printf("%ld \n", x*y);
|
||
|
return 0;
|
||
|
}
|