๐
This file contains hidden or 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
| // www.abukhleif.com | |
| #include <iostream> | |
| using namespace std; | |
| void EvenOdd (int num, int& evens, int& odds) { | |
| evens = odds = 0; | |
| while (num != 0) { | |
| if (num % 2 == 0) | |
| evens++; | |
| else | |
| odds++; |
This file contains hidden or 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
| // www.abukhleif.com | |
| #include <iostream> | |
| using namespace std; | |
| int reverseDigit (int num){ | |
| bool isNegative = false; | |
| if (num < 0){ | |
| isNegative = true; | |
| num = -1 * num; | |
| } | |
| int reversedNumber = 0; |
This file contains hidden or 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
| // www.abukhleif.com | |
| int reverseDigit (int num){ | |
| bool isNegative = false; | |
| if (num < 0){ | |
| isNegative = true; | |
| num = -1 * num; | |
| } | |
| int reversedNumber = 0; | |
| while (num > 0){ | |
| int d = num % 10; |
This file contains hidden or 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
| int reverseDigit (int num){ | |
| int reversedNumber = 0; | |
| while (num > 0){ | |
| int d = num % 10; | |
| reversedNumber = reversedNumber * 10 + d; | |
| num /= 10; | |
| } | |
| return reversedNumber; | |
| } |
NewerOlder