if statement error
i wrote this program to display even number from 100-200. But visual c gives me this error with undeling the "a" in if statement.
Error 1 error C2106: '=' : left operand must be l-value |
1 2 3 4 5 6 7 8 9 10 11 12 13
|
#include<iostream>
#include<conio.h>
using namespace std;
void main(){
for(int a=100;a<200;a++){
if(a%2=0)
cout<<a<<endl;
}
_getch();
}
|
Last edited on
Line 9 must be:
if(a % 2 == 0)
and main() must return an integer:
int main()
Last edited on
Topic archived. No new replies allowed.