Fehler im Code
-
Hallo alle zusammen,
ich die Fehler im Code nicht erkennen, kann mir jemand helfen?#include <stdio.h>
int abs(int x)
{
return((x>0)?x:-x);
}main()
{
int x =3, y = -9, z = 7;
long abc;
abc=abc(abc(x*y)*z);
printf("Der %s von %d*%d*%d ist %f.",
"Betrag", x, y, z, abc);
}Vielen Dank im Voraus
-
#include <stdio.h> int abs(int x) { // bei x == INT_MIN gibt es Probleme // INT_MIN ist in der <limits.h> definiert. return((x>0)?x:-x); } main() { int x =3, y = -9, z = 7; long abc; // Warum long ? abc=abc(abc(x*y)*z); // Wie heisst die Funktion? Und warum rufst du sie zweimal auf? printf("Der %s von %d*%d*%d ist %f.", // Für welchen Datentyp ist %f da? "Betrag", x, y, z, abc); }