Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solución reto #1 en C++ #1295

Open
yasperht opened this issue Feb 13, 2024 · 0 comments
Open

Solución reto #1 en C++ #1295

yasperht opened this issue Feb 13, 2024 · 0 comments

Comments

@yasperht
Copy link

#include <bits/stdc++.h>
using namespace std;
#define endl '\n'

bool isMultipleOfThree(int value){
    return value % 3 == 0;
}

bool isMultipleOfFive(int value){
    return value % 5 == 0;
}

void printNumbersFromOneToOneHundred (){
    const int MIN = 1;
    const int MAX = 100;
    
    for (int i = MIN; i <= MAX; i++){
        if (isMultipleOfThree(i) && isMultipleOfFive(i)) {
            cout << "fizzbuzz" << endl;
            continue;
        }

        if (isMultipleOfThree(i)) {
            cout << "fizz" << endl;
            continue;
        }

        if (isMultipleOfFive(i)) {
            cout << "buzz" << endl;
            continue;
        }

        cout << i << endl;
        
    }

}


int main (){
    system("cls");
    printNumbersFromOneToOneHundred();

    cout << "\n";
    return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant