-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#include <iostream> | ||
#include <cmath> | ||
|
||
using std::cout; | ||
using std::cin; | ||
|
||
int16_t isEven(int16_t x); | ||
|
||
int main() | ||
{ | ||
cout << "Please enter a #: "; | ||
int32_t x{}; | ||
cin >> x; | ||
cout << "Please enter the ^ you would like to use: "; | ||
int32_t y{}; | ||
cin >> y; | ||
cout << "Answer is: " << pow(x , y) << "\n"; | ||
|
||
int16_t a{7}; | ||
int16_t b{4}; | ||
|
||
cout << "int16_t / int16_t = " << a / b << "\n"; | ||
cout << "int16_t / double = " << a / static_cast<double>(b) << "\n"; | ||
|
||
cout << "Inser a # and we'll check if it's even or odd: "; | ||
int16_t number{}; | ||
cin >> number; | ||
isEven(number); | ||
|
||
return 0; | ||
} | ||
|
||
int16_t isEven(int16_t x) { | ||
|
||
if (x % 2 == 0) { | ||
cout << "It's an even #!!" << "\n"; | ||
} else { | ||
cout << "Nope, definitely not a even #" << "\n"; | ||
} | ||
|
||
// (x % 2 == 0) ? cout << "It's an even #!!" << "\n" : cout << "Nope, definitely not a even #" << "\n"; | ||
|
||
return 0; | ||
} |