int main() {
int year;
cout<<"enter a year:";
cin>>year;
if(year%4==0) %% (year&100!=0) || (year %400==0)
cout<<"this is a leap year\n";
else
cout<<"this is not a leap year\n";
return 0;
You forgot to put parenthesis in the code and (&&) operator which does logical AND function
code should be as follows:
#include <iostream>
using namespace std;
int main() {
int year;
cout<<"enter a year:";
cin>>year;
if((year%4==0) && (year&100!=0) || (year %400==0)){
cout<<"this is a leap year\n";
}
else{
cout<<"this is not a leap year\n";
}
return 0;
}
#include <iostream>
usingnamespace std;
int main() {
int year;
cout<<"enter a year:";
cin>>year;
if(year%4==0) %% (year&100!=0) || (year %400==0)
cout<<"this is a leap year\n";
else
cout<<"this is not a leap year\n";
return 0;
FAIL !!
tell me exactly what you want this program to do, and for what you need it, so that i can help you.
Are you even paying attention to what you're writing?
You mistyped && and %, you forgot two parenthesis and a closing bracket and you misspelled "Enter".
The (non-existent) problem description tops it off.
Compilers are not as forgiving as some people are, so programming is probably not for you.