TCS-Infosys-IBM Interview Question |Decimal to Binary | Daily Dose -32 | Tamil | code io

preview_player
Показать описание
Decimal to Binary - Geeks for Geeks

TCS Playlist:

--------------------------------------------------------------------------------------------------------------------
TCS Codevita - TCS Interview Question

Join our Telegram Forum for more Discussions

Follow us in Instagram for more updates

#gfg #DailyDose #codeio
Рекомендации по теме
Комментарии
Автор

Binaryl%10 remainder value reverse print in decimal values 😁

gowsalyar.s
Автор

Multiply the digits to 2^N, where N belongs to (0, len (binary)) and find its sum.

prithiviraaj
Автор

Digt(0)*2⁰ + Digit(1)*2¹ +....+ Digit(n)*pow(2, n)

nithishkumark
Автор

Bro pattern printing solli kudu ya easy ah

HdjshHdhhhs
Автор

#include <iostream>

using namespace std;

int main()

int n=1010;

int base=2;

int exponent=0;

int r:

int sum=0;

while (n!=0) {

int result=1;



r-n%10;

for(int i=0;i<exponent;i++){

result =base;

}

exponent++;


sum+=(r*result);

n /=10;

}

cout<<sum;

}

ECKSivakumar
Автор

int n = 100001;
int ans = 0;
int fact = 0;

while (n != 0){
ans += n % 10 * Math.pow(2, fact) ;
fact++;
n /= 10;
}
System.out.println(ans);

dethia