2
I’m having a problem making rest of the division. Gave that mistake:
value required as left operand of assignment
How do I fix it?
#include <stdio.h>
#include <stdlib.h>
int main()
{
int x;
printf("informe o numero inteiro: \n");
scanf("%d",&x);
if (x>0)
{
printf("numero positivo ");
}
else {
printf("numero negativo ");
}
if (x % 2 = 0)
{
printf("e par");
}
else {
printf("e impar");
}
return 0;
}
The error is that you used the assignment operator
=
instead of the comparison==
.– bfavaretto
Do not forget to check if the program provides the result you expect for x = 0.
– Marcos Banik