Professional Documents
Culture Documents
C++ Code
C++ Code
#include <cmath>
int promptSAPID() {
int sapID;
return sapID;
num /= 2;
base *= 10;
return binary;
}
int countOnesOrZeros(int binary, int target) {
int count = 0;
if (digit == target)
count++;
binary /= 10;
return count;
int main() {
if (sapID % 10 == 0 || sapID % 10 % 2 == 0) {
cout << "Binary representation of last 2 digits: " << binary << endl;
cout << "Number of zeros in binary representation: " << zerosCount << endl;
else {
cout << "Number of ones in binary representation: " << onesCount << endl;
return 0;