Lecture 6: Binary & Decimal Number System

preview_player
Показать описание
In this Video, we are going to learn how to implement:
- Binary to Decimal Conversion
- Decimal to Binary Conversion

There is a lot to learn, Keep in mind “ Mnn boot karega k chor yrr apne se nahi yoga ya maza nahi para, Just ask 1 question “ Why I started ? “

Homework: Added in Video already
Homework Timestamps [21:20]

Telegram Group Link: Love Babbar CODE HELP

Do provide you feedback in the comments, we are going to make it best collectively.

Connect with me here:

Intro Sequence: We have bought all the required Licenses of the Audio, Video & Animation used.

Timestamps:

00:00 - Introduction
01:10 - Decimal to Binary
02:34 - Promotion
03:42 - Examples
14:35 - Implementation
21:20 - Homework
23:38 - Binary to Decimal
28:00 - Implementation

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

Also make sure to give a visit to our Video sponsors:🙂

CodeHelp
Автор

First I have completed all DSA series and now conclude this is Greatest ever DSA series to exist on youtube or paid courses. Your contribution will be remembered. You're God of DSA for us🙇‍♂

govindsuryavanshi
Автор

If anyone is not getting correct output of Decimal to Bianry .Then use ans variable as float.Because many students are facing this issue in offline compiler.

amanbhobhria
Автор

22:30 The sum of 1 + 1 in binary is 10. The rightmost digit, which is 0, is written as the sum, and the leftmost digit, which is 1, is carried over to the next column. This is similar to carrying over in decimal addition when the sum of digits in a column is 10 or more.

rnjnmhta.catomato
Автор


Attendance marked☑️☑️
Bhaiya aise hi plz basic pura cover karna...maja aa raha h bahut padne mei aapse ❤️❤️❤️

rishabhsharma
Автор

If u are using c compilers like codeblocka etc try assigning the ans as float, assign a new int variable as ans1
Then before the printf statement after the loop ends convert the float ans to ans1 by dividing with 1 and store it in ans1
Print the ans1 and there u go

mdsabilsarfaraz
Автор

Itna aacha koi teacher nhi padhta
You are true gem sir
Hatts off🙌🙌🙌

_abhishekchoubey
Автор

(Your + Our) consistency and hardwork == Our dream comes true.

sounaksaha
Автор

Bro it seems you were having little bit breathing issues but still you finished the lecture in one go. Great dedication hats off sir.👍

ayushmansingh
Автор

1’s and 0’s -pura CS ka basics, tagda conceptt 🔥

iharshbhanushali
Автор

Recently I have started to watch your videos and believe me these are blessing for beginner

khushboo
Автор

h/w question
Logic for converting the number to 2's complement :
1. convert the number into binary ( normal way, no complementation);
2. Print the binary digits from right (lsb) to left (msb) as it is till first 1. After that write 1's complement.

Example-
here write from right side til first one means - 10001
then write 1's complement after that, so
Answer =

So for coding, at first take an array of 32 elements because integer size is 32 bits in my device. Each element of an array denotes one bit in the input integer.
Initialise all the elements to 0.

#include <iostream>
using namespace std;

int main() {
int arr[32], i ;
int n;
while(1)
{
cin>>n;
for(i=0;i<32;i++)
{
arr[i]=0;
}
if(n<0)
{
int d;
d=-n;
int digit, bit, flag;
flag =0;
i=31;
while(d!=0)
{
bit=d&1;
if(flag==0)
{
arr[i]=bit;
if (bit==1)
{
flag=1;
}
}
else
{
arr[i]=(!bit);
}
d=d>>1;
i--;
}
while(i>=0)
{
arr[i]=1;
i--;
}
for(i=0;i<32;i++)
{
cout<<arr[i];
}
}
else
{
int digit, bit;
i=31;
while(n!=0)
{
bit=n&1;
arr[i]=bit;
n=n>>1;
i--;
}
for(i=0;i<32;i++)
{
cout<<arr[i];
}

}
cout<< endl ;
}

}

sp_
Автор

#Day_3 Video Completed

Code for Negative as well as Postive nos to convert it into binary:

#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
cout<<"The Binary of the Number is : "<<bitset<32>(n)<<endl;
return 0;
}

singhvishal
Автор

you are the best .Never demotivate for less views . Please complete the whole playlist.

terabaapaya
Автор

POWERFUL LECTURE !!! it took me more than 2 hours to understand and self implement each and every line in this video, and it was so knowledgeable . THANK YOU

shubbhamarya
Автор

17:08 Jis jis ka bhi vscode m different answer aa rha h, 😄
due to compiler,
iska ye solution h.




#include <iostream>
#include <math.h>
using namespace std;
int main(){
int n;
cout << "Enter the value of N \n";
cin >> n;
int ans = 0;
int i=0, m=1;
while(n!=0){
int bit = n%2;
ans = (bit * m ) + ans;
i++;
n = n/2;
m = m * 10;
}
cout << ans << endl;

}







**ps ye mene khud se banaya h 😁😁

devanshsk
Автор

Best Concepts, on the point, in dept 🔥by experienced person 👌.Hope this type of quality continues till the end of this complete series !!!! .

avibirla
Автор

I think we can create a generic implementation where we can use 2 parameters fromBase and toBase, 1. we need to get modulus of toBase
2. Store in a variable after initial answer *fromBase raise to correct power
3. thereafter dividing the number by toBase each time till its zero

tiyasha
Автор

I have watched many tutorials.... got confused left in between... hated coding... self doubted... but this tutorial is really amazing:)) Sort of getting confidence! Thanks a ton***

mayuriiizzsonawane
Автор

Bhaiya consistency dekh ke dil khush ho gaya.. ekdam motivated feel hota apki video dekhe

harpratapsinhnakoom