PAPAmidNIHGT - 1 year ago 62
C Question

# C eror in comparing 3 numbers (1 of them is negative)

it would be nice if someone would help me with my code .
According to task i have a few numbers (at least 1 negative) in case i`m getting 3 numbers > 0 or = 0 then answer is 0 .Cod should find the closest to 0 number. Here is my cod but it is not working .

#include <stdio.h>
#include <conio.h>
int main()
{
int uno, dos, tres; //numbers

scanf_s("%d %d %d", &uno, &dos, &tres);
if (uno > 0 || uno == 0 && dos > 0 || dos == 0 && tres > 0 || tres == 0)
printf("There is no negative numbers ...");
else if (uno == 0 || uno > 0 && dos > 0 || dos == 0 && tres < 0)
else if (uno > 0 || uno == 0 && dos < 0 && tres < 0)
if (dos < tres || tres == dos)
else
else if (uno < 0 && dos < 0 && tres < 0)
if (uno < dos && uno < tres)
if (dos < tres || tres == dos)
else printf("Your number is %d", dos);
else if (dos < uno && dos < tres)
if (uno < tres|| uno==tres)
else printf("Your number is %d", &uno);
else if (tres < uno && tres < dos)
if (uno < dos || uno==dos)

_getch();
return 0;
}

Appreciate any help.