APL1.1
CM1
CM2
CMB1
SAE11_2021
TP01
TP02
TP03
TP04
TP05
TP06
TP07
TP08
TP09
TP10
TP11
TP12
TP13
TP14
initiales.c
lecture.c
miroir.c
multiplication.c
statistiques.c
truandage.c
TP15
TP16
TP17
controle_machine
APL1.2
APL2.1
HTML
Révisions
.gitignore
README.md
35 lines
681 B
C
35 lines
681 B
C
|
#include<stdio.h>
|
||
|
#include<stdlib.h>
|
||
|
#include<string.h>
|
||
|
|
||
|
int main(int argc, char * argv[]) {
|
||
|
long x, y;
|
||
|
char* position_x;
|
||
|
char* position_y;
|
||
|
|
||
|
x = strtol(argv[1], &position_x, 10);
|
||
|
y = strtol(argv[2], &position_y, 10);
|
||
|
|
||
|
if ((x == 0) && (position_x==argv[1])) {
|
||
|
puts("Entier invalide.");
|
||
|
return EXIT_FAILURE;
|
||
|
} else if (*position_x != '\0') {
|
||
|
puts("Conversion partielle !");
|
||
|
return EXIT_FAILURE;
|
||
|
}
|
||
|
|
||
|
if ((y == 0) && (position_y==argv[2])) {
|
||
|
puts("Entier invalide.");
|
||
|
return EXIT_FAILURE;
|
||
|
} else if (*position_y != '\0') {
|
||
|
puts("Conversion partielle !");
|
||
|
return EXIT_FAILURE;
|
||
|
}
|
||
|
|
||
|
long z = x * y;
|
||
|
printf("%d * %d = %d\n", x, y, z);
|
||
|
|
||
|
return EXIT_SUCCESS;
|
||
|
}
|
||
|
|