Stuff
public text v1 · immutableint
main (void)
{
int i = 0;
char buf[256];
char n1[64], n2[64];
int nb, nb1, nb2;
int test = 0;
char *p, *p2, *ret;
printf("Entrer le nombre\n");
scanf("%s", &buf);
printf("buf: %s\n", buf);
p = buf;
p2 = buf;
while ((isdigit(*p)) && (*p != 0))
p++;
if (*p == '/')
{
strncpy(n1, p2, p - p2);
nb1 = atoi(n1);
test++;
}
p++;
strncpy(n2, p, p - p2);
nb2 = atoi(n2);
if (!test)
nb = atoi(buf);
else
nb = nb1/nb2;
return 0;
}