Learning DSA (#1)Bhuwan Sharma·May 22, 2024·1 min read#include <iostream> #include <math.h> using namespace std; int main(){ // Decimal to binary: int n; cout<<"enter: "; cin>>n; int r, i=0, p, ans = 0; while(n!=0){ r = n&1; n = n>>1; p = (r*pow(10,i)) + ans; ans = p; i++; } cout<<p;f } DSAAIMLcodingC++ Share this