If function ( HELP! )
Hi everyone,
I just starting programming and I'm a total noob so I'd like your help please.
I don't know whats wrong with my code, I get this error [Error] 'else' without a previous 'if'
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
#include<stdio.h>
#include<conio.h>
int main()
{
int A,B;
printf("Donnez le 1er nombre");
scanf("%d",&A);
printf("Donnez le 2eme nombre");
scanf("%d",&B);
{
if (A<0 || B<0);
printf("Le produit est négatif\n");
else
printf("Le produit est positif\n");
}
getch();
return 0;
}
|
Please can you help me ?
You shouldn't have a semi-colon at the end of an if statement, line 12.
What you did is the equivalent of
1 2 3 4 5
|
if (...)
{ }
printf("...");
else //where's the if?
prtinf("...");
|
Last edited on
I removed the semi-colon in line 12 and It's working!!
Thanks a lot :DD
Topic archived. No new replies allowed.