mercredi 4 février 2015

'else' without a previous 'if'

I am just beginning to learn C programming, so I am not really on an advanced level. Bear with me!


I have this piece of code, and I guess that it is pretty easy to understand what I am trying to do. However I get an error saying the last else is called without an if before it.


I suspect that the problem is my if-else statement inbetween the if and else. How would you guys solve it?



int talet;
scanf("%d",&talet);

int i=1;
while(i<=99)
{
int a;
{
if (i%talet==0 || talet==(i/10)%10 ||talet==i%10)
{
if (talet%10==0)
printf("\n");
else
continue;
}
printf("burr ");
else
printf("%d ",i);
}
i=i+1;
}

Aucun commentaire:

Enregistrer un commentaire