subject

Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in binary. For an integer x, the algorithm is: As long as x is greater than 0
Output x % 2 (remainder is either 0 or 1)
x = x / 2
Note: The above algorithm outputs the 0's and 1's in reverse order.
Ex: If the input is:
6
the output is:
011
#include
using namespace std;
int main() {
/* Type your code here. */
return 0;
}

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 17:30
Where would you click to edit the chart data?
Answers: 1
question
Computers and Technology, 23.06.2019 21:00
Which task uses a simple parameter?
Answers: 1
question
Computers and Technology, 23.06.2019 23:40
4. what is the reason for including the following code snippet in the header file animal.h? #ifndef animal_h #define animal_h class animal { public: animal(); animal(double new_area_hunt); void birth(); void hunt(double new_area_hunt); void death(); double get_area_hunt() const; private: double area_hunt; }; #endif
Answers: 3
question
Computers and Technology, 24.06.2019 06:30
Ineed to know the anwser to all these questions
Answers: 2
You know the right answer?
Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's repre...
Questions
question
History, 09.02.2021 05:40
question
Mathematics, 09.02.2021 05:40
question
Mathematics, 09.02.2021 05:40
question
English, 09.02.2021 05:40
question
Mathematics, 09.02.2021 05:40
Questions on the website: 13722367