0

write a c++ program to convert a decimal number to binary number

27th Apr 2021, 12:08 PM
qais
qais - avatar
4 Answers
+ 1
qais No I am very busy person.
27th Apr 2021, 2:34 PM
A͢J
A͢J - avatar
0
#include <iostream> using namespace std; int main() { int n; cout << "decimal num" << "\n"; cin >> n; for (int i = 7; i >= 0; i--) { int k = n >> i; if (k & 1) cout << "1"; else cout << "0"; } return 0; }
27th Apr 2021, 12:09 PM
qais
qais - avatar
0
Hello Your code output is right. What is issue there?
27th Apr 2021, 12:49 PM
A͢J
A͢J - avatar
0
🅰🅹 🅐🅝🅐🅝🅣 Can I send you a message to help me write a program?
27th Apr 2021, 1:13 PM
qais
qais - avatar