Skip to content

Commit

Permalink
Decimal To Binary Stack Function
Browse files Browse the repository at this point in the history
  • Loading branch information
ahany42 committed Jun 1, 2024
1 parent dc95aa6 commit ebd2884
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Ds-Stacks/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,14 @@ void EvenFirst(queue<int>& q) {
}

}
stack<int> DecimalToBinary(int number) {
stack<int> binaryStack;
while (n > 0) {
binaryStack.push(number % 2);
number = number / 2;
}
return binaryStack;
}
int main()
{

Expand Down

0 comments on commit ebd2884

Please sign in to comment.