Conditional Programs
C++ if / else: even/odd, leap years, vowels. The equal-to case is the quiet bug.
4 programs · open one, then the next
Start with Check for Even Odd- 01Check for Even OddBeginnerCheck even or odd in C++ with n % 2. Remainder 0 is even.Open example →cpp#include <iostream> using namespace std; int main() {
- 02Largest Among 3BeginnerFind the largest of three numbers in C++. Use >= so ties don't fall through.Open example →cpp#include <iostream> using namespace std; int main() {
- 03Vowel/Consonant CheckBeginnerCheck vowel vs consonant in C++. Fold case or 'A' looks like a consonant.Open example →cpp#include <iostream> #include <cctype> using namespace std;
- 04Leap Year CheckBeginnerLeap year in C++: 2000 is, 1900 isn't. Divisible by 4 is not the whole rule.Open example →cpp#include <iostream> using namespace std; int main() {