You are viewing a single comment's thread. Return to all comments →
int main() { int N = parse_int(ltrim(rtrim(readline()))); if (N>=1 && N<=100) { if (N%2!=0) printf("Weird"); else { if ((N%2==0) && (N>=2 && N<=5)) printf("Not Weird"); else { if ((N%2==0) && (N>=6 && N<=20)) printf("Weird"); else { if ((N%2==0) && (N>20)) printf("Not Weird"); } } } } else printf("Not a positive integer."); return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Day 3: Intro to Conditional Statements
You are viewing a single comment's thread. Return to all comments →
For C Language
int main() { int N = parse_int(ltrim(rtrim(readline()))); if (N>=1 && N<=100) { if (N%2!=0) printf("Weird"); else { if ((N%2==0) && (N>=2 && N<=5)) printf("Not Weird"); else { if ((N%2==0) && (N>=6 && N<=20)) printf("Weird"); else { if ((N%2==0) && (N>20)) printf("Not Weird"); } } } } else printf("Not a positive integer."); return 0; }