-1

NUMBER DEFINITION - 100% WORKS

đã đăng vào 18, Tháng 11, 2021, 21:04

Hello every body, today, I will tell you how to make a number definitor. This ND will define a number is an even/an odd/a negative even/a negative odd or that's just equal 0. Now, let's get started. Check the code inside the box (Below the "Code zone" text) and copy it into your program. (Code::Blocks strongly recommended) CODING TYPE = CPP (C++)

SPECIAL ZONE!!!: 🎞 Subcribe to my youtube at: 👉 https://www.youtube.com/channel/UCvpqlnV29UZks3FsiZGs75w. No video yet, sorry :)

Code zone:

#include <bits/stdc++.h>
using namespace std;

int main() {
    int a;
    cout << "Please enter the number you would like to define" << endl;
    cin >> a;
    if (a > 0 && a % 2 == 0) cout << "NUMBER TYPE:EVEN" << endl;
    else if (a > 0 && a % 2 == 1) cout << "NUMBER TYPE:ODD" << endl;
    else if (a < 0 && a % 2 == 0) cout << "NUMBER TYPE: NEGATIVE EVEN" << endl;
    else if (a < 0 && a % 2 == -1) cout << "NUMBER TYPE: NEGATIVE ODD" << endl;
    else cout << "THE NUMBER IS EQUAL 0" << endl;
    return 0;
}

FEEL FREE TO COMMAND BELOW IF YOU GET THE ERROR WHILE CODING :)


Đang tải...