Neden kod çalışmıyor?

c dilinde yeniyim ve basit şeyler yapmaya çalışıyorum mantığını anlamak için ama kod istediğim gibi çalışmıyor.
int main()
{
int a;
printf(“Bir Sayi Giriniz:”);
scanf("%d", &a);

if (a>0)
{
    printf("Sayiniz Pozitif");
}

else (a<0);
{
    printf("Sayiniz Negatif");
}
return 0;

}

kod bu ama pozitif değer girdiğimde Sayiniz PozitifSayiniz Negatif bu yazıyı alıyorum yardımcı olur musunuz?

değil

else if (a<0)
olacak

else if (a<0) olacak, else’den sonra şart (condition) yazılmaz.

1 Beğeni

Compiler’inin butun hata ve uyari mesajlarini ac:

a.c: In function ‘main’:
a.c:4:1: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
    4 | printf("Bir Sayi Giriniz:");
      | ^~~~~~
a.c:4:1: warning: incompatible implicit declaration of built-in function ‘printf’
a.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
  +++ |+#include <stdio.h>
    1 | int main()
a.c:5:1: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration]
    5 | scanf("%d", &a);
      | ^~~~~
a.c:5:1: warning: incompatible implicit declaration of built-in function ‘scanf’
a.c:5:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
a.c:12:8: warning: statement with no effect [-Wunused-value]
   12 | else (a<0);
      |      ~~^~~