Special Programs in C − Binary to Decimal Conversion

  Рет қаралды 246,589

Neso Academy

Neso Academy

Күн бұрын

Пікірлер
@sunnygomes608
@sunnygomes608 3 жыл бұрын
Best channel for computer science students so far. Thanks for making such great contents.
@boblopez7649
@boblopez7649 Жыл бұрын
I did this program using shift left operator(
@mayankjadhav4509
@mayankjadhav4509 6 жыл бұрын
Thank you so much sir...today i understood the program and Sir please post binary to octal and hexadecimal too...
@Obama6464
@Obama6464 2 жыл бұрын
Great lecture. Many ways this can be done (including using the math.h library and utilizing the pow() function) but the previous person that taught me this didn't explain why we were doing the modulus and division in a clear way. You, however, did. Thanks!
@-HarishkumarG
@-HarishkumarG 3 жыл бұрын
Idk how am I going to survive in IT field 😭
@ibtissamelhammoumy9586
@ibtissamelhammoumy9586 3 жыл бұрын
don't worry
@-HarishkumarG
@-HarishkumarG 3 жыл бұрын
@@ibtissamelhammoumy9586 thanks :-)
@AshutoshKumar-jj6kz
@AshutoshKumar-jj6kz 2 жыл бұрын
same here no logic only magic in programming
@nileshtayade3546
@nileshtayade3546 2 жыл бұрын
Don't worry bro me bhi apke jaisa hi sochta tha lekin dhire dhire Sab samaj ate jata hai bas koshish karte rho
@AlameenAdeyemi
@AlameenAdeyemi 10 ай бұрын
It's 2024,how are u doing now bro
@ramdayalkumawat2568
@ramdayalkumawat2568 4 жыл бұрын
Sir this is so wonderful lecture
@madhavikatta7346
@madhavikatta7346 6 жыл бұрын
Thank you so much Sir one day I will be in the good position definitely on that day I will sponsor huge amount money to our channel
@ashokkumark2243
@ashokkumark2243 4 жыл бұрын
We store hex value starts with 0x, and octal starts with 0 and decimal as it is in the integer type.. How do we store a binary number in the integer type?? Here why do we convert a decimal number to decimal again?? Where actually is it useful?? Can someone please explain??
@AidenSalts
@AidenSalts 4 жыл бұрын
what?
@mdabubakar6874
@mdabubakar6874 3 жыл бұрын
have u read digital electronics???
@roshnimishra3454
@roshnimishra3454 6 жыл бұрын
nice one made the concept very clear very helpful
@dambro3312
@dambro3312 2 жыл бұрын
i did it using biwise operators! it worked! ig int bin_dec() { int bin,dec; scanf("%d",&bin); for (int shift; bin!=0; shift++) { int r = bin%10; dec = (r
@rudrachakraborty7896
@rudrachakraborty7896 Жыл бұрын
Thank you, sir. This really helped me with my paper 1 programming practice. From London
@nikhilsingh7666
@nikhilsingh7666 3 жыл бұрын
nice lecture I got a hint for the CodeChef challenge thanks
@arnoldgatchalian8643
@arnoldgatchalian8643 3 жыл бұрын
Thank you I've learned a lot from you
@Deepthi_Chowdary5321
@Deepthi_Chowdary5321 Жыл бұрын
Sir u make more series on only focusing on problem..
@YashDEVELOPER12
@YashDEVELOPER12 4 жыл бұрын
Very beautiful explanation sir.. u r amazing 🙏
@HuynhThanhThuan
@HuynhThanhThuan 4 жыл бұрын
Very easy to understanding, thank you dear Sir.
@vinaykamble162
@vinaykamble162 3 жыл бұрын
It's amazing explanation ❤️
@shreya9275
@shreya9275 2 жыл бұрын
Absolutely Brilliant explanation
@beauty-ez8ox
@beauty-ez8ox Жыл бұрын
Wow 💜💜💜 ... So nicely explained
@kapiljetwani3540
@kapiljetwani3540 3 жыл бұрын
thank u for such a nice explaination!
@avishekkbhatta
@avishekkbhatta Жыл бұрын
best channel.................................................
@shikhajamwal4709
@shikhajamwal4709 3 жыл бұрын
u have explained it very well
@tumutarun5157
@tumutarun5157 6 жыл бұрын
Upload all videos in c language for learners
@mdmuquimakhter5145
@mdmuquimakhter5145 2 жыл бұрын
awesomely explained
@sahilarora7186
@sahilarora7186 2 жыл бұрын
very nice explanation thank you sir
@itsbayahmed
@itsbayahmed Жыл бұрын
Here is another solution to this problem: #include #include int main() { long long int number, num, result, n; printf("Please Enter the Binary number: "); scanf("%lld",&number); result = 0; n =0; num = number; while(num != 0) { result = result + (num % 10) * pow(2,n) ; n++; num = num / 10; } printf("%lld in decimal is %lld", number, result); return (0); }
@nishabhandari5190
@nishabhandari5190 3 ай бұрын
Thank you so much professor
@gayathripvl8184
@gayathripvl8184 3 жыл бұрын
sir you are doing very great job
@gopichowdary2040
@gopichowdary2040 6 жыл бұрын
Sir please upload daily one video like circuit theory videos are being uploaded
@Hichamb04
@Hichamb04 2 жыл бұрын
thanks bro that was so helpful .
@aakashmudigonda3375
@aakashmudigonda3375 4 жыл бұрын
if anyone of you guys, didn't understand the above code, this my own code, which I made from a simpler logic.... #include #include int main(void) { // example : convert 1 0 0 1 to decimal // [1]*2^(3)+ [0]*2^(2)+ [0]*2^(1) + [1]*2^(0) printf("enter a binary number : "); int n; scanf("%d",&n); int temp = n; int rem = 0; int result = 0; int count = 0; int last_num= 0; while (temp!=0) { temp = temp/10; count++; } temp = n; for (int i = 0; i
@namraarif100
@namraarif100 4 жыл бұрын
Very helpful video sir But you did not initialize rem in start. Will it not a problem to run this program?
@manojraut9630
@manojraut9630 2 жыл бұрын
You are Best.👏
@andistheinforitbutso7513
@andistheinforitbutso7513 2 жыл бұрын
All hail 🙌 Neso Academy
@HelderKJPedro
@HelderKJPedro 2 жыл бұрын
Thank you so much 🙏🏽
@5303sandeep
@5303sandeep 5 жыл бұрын
Here is the code for invalid input for eg:- 1201(which is not binary) #include int main() { //Initialization and user input int b,rem,decimal = 0,w = 1,num,c=0;//w = weight,b = binary printf("Enter binary number to covert to decimal "); scanf("%d",&b); num = b; //Binary to Decimal Conversion while(num!=0) { rem = num%10; if(rem>1) { printf("Invalid input:Input contains number other than 0 and 1 Please enter a valid input "); c = 1; break; } else { decimal = decimal + rem*w; num = num/10; w = w*2; } } //Printing result if(c==0) printf("%d is the decimal conversion of binary %d",decimal,b); }
@tusharmathur5360
@tusharmathur5360 3 жыл бұрын
thanks bro for sharing
@komkirisma3347
@komkirisma3347 2 жыл бұрын
how to do it for decimal?
@basics698
@basics698 6 жыл бұрын
Please make videos on control systems.
@Khadra2024
@Khadra2024 3 жыл бұрын
if i want to check if the number have only 1 and 0 how can i do that? if it has other number, send error message :(
@mdathar1947
@mdathar1947 2 жыл бұрын
Sir pls cover the corners case also...
@mdathar1947
@mdathar1947 2 жыл бұрын
If I enter a binary contain more than 10 digit ....2. if I enter for eq-101101010101 Will your program work in these 2cases??
@zoreladreanrivera9822
@zoreladreanrivera9822 7 ай бұрын
#include #include int main ( void ) { int binary; printf ( "Enter binary number: " ); scanf ( "%d", &binary ); int counter1 = 0; int A = binary; while ( A != 0 ) { A /= 10; counter1++; } int remainder = 0; int power = 0; int sum = 0; for ( int counter2 = 0; counter2 < counter1; counter2++ ) { remainder = binary % 10; power = ( pow ( ( remainder * 2 ), counter2 ) ) * remainder ; sum += power; binary /= 10; } printf ( "Decimal Equivalent = %d", sum ); return 0; }
@bkrulz1280
@bkrulz1280 4 жыл бұрын
How to write it in a recursive function
@ColorsOfLife114
@ColorsOfLife114 2 жыл бұрын
As the weight of first digit from right side is zero then why we take it 1???
@dheerajk7
@dheerajk7 3 жыл бұрын
Thankyou so much sir
@jagugamit150
@jagugamit150 3 жыл бұрын
I am getting error Input :- 0011 Output :- 9 Expected output should : - 3
@sowmyapg3381
@sowmyapg3381 3 жыл бұрын
Understood thankyou
@ArunChoudhary-lr7rp
@ArunChoudhary-lr7rp 11 ай бұрын
Outstanding
@ic4r023
@ic4r023 4 жыл бұрын
Very good video. But I replicated the exact same code in Dart (doing the syntax changes) and the result was different! It gave me 11.24999999. There is my code in Dart: num binary = 1001; num decimal = 0; var base = 1; void main (){ while(binary != 0){ var rem = binary % 10; decimal = decimal + rem*base; binary = binary / 10; base = base*2; } print(decimal); } Can someone please explain to me where I'm wrong?
@tusharmathur5360
@tusharmathur5360 3 жыл бұрын
seems nothing wrong
@ramanandasharma9214
@ramanandasharma9214 2 жыл бұрын
please give the flowchart and algorithm for this
@sinchana9358
@sinchana9358 4 жыл бұрын
Plzz make a vedio on how to convert decimal to binary plzz sir🙏🙏
@archipalexandru-ioan5898
@archipalexandru-ioan5898 3 жыл бұрын
#include int main() { int var=65; int i; int bit; for(i=8;i>0;i--) { bit=(var>>i-1) &1; printf("%d",bit); } }
@archipalexandru-ioan5898
@archipalexandru-ioan5898 3 жыл бұрын
here you have,65 is the number converted to binary,the for its from 8 to 1,so you can store the bits from left to right
@songoku2013
@songoku2013 3 жыл бұрын
But what if the input is '101.011' or any other fractional binary number ? How to program that ?
@TheJoker-xw5pd
@TheJoker-xw5pd 3 жыл бұрын
Bro agar hum koi or number add kare like as jo binary me na ho to code invalid ana chaiye to kaise hoga
@Ginihiniikk986
@Ginihiniikk986 4 жыл бұрын
what is weight??
@rameshv2762
@rameshv2762 4 жыл бұрын
It's a decimal value of number at certain position in a binary number.. Wn you travel from Lsb to msb... The value changes frm 2 to 2^n ..🙂
@gamingcousinstamil
@gamingcousinstamil 2 жыл бұрын
Super sir
@poojajagtap6356
@poojajagtap6356 3 жыл бұрын
thanks sir
@nazmashaik2558
@nazmashaik2558 5 жыл бұрын
Sir I execute this program but the out put is not correct there is so different.what can I do
@AdityaGupta-pl1ss
@AdityaGupta-pl1ss 3 жыл бұрын
What is the meaning of Weight here
@ashishsinha8893
@ashishsinha8893 6 жыл бұрын
Sir u r going to upload videos in daily basis or not ???????
@muhammedshafeek3905
@muhammedshafeek3905 3 жыл бұрын
In code blocks if I use space in print"%d " after %d before " once I build the code code block become stuck how I solve this
@jagadeeshwaran1512
@jagadeeshwaran1512 3 жыл бұрын
I just added a feature to this program, i.e., to display a error message when a non binary number is entered.
@subhadeepsinha1006
@subhadeepsinha1006 3 жыл бұрын
how r you pirate king??
@minku2108
@minku2108 2 жыл бұрын
Program for binary to hexa?
@true4189
@true4189 4 жыл бұрын
Thank u
@mousex5532
@mousex5532 6 жыл бұрын
thankyou
@amudhapi6492
@amudhapi6492 4 жыл бұрын
Why weight=1 and what r the purpose for use weight plz reply me
@arunjithajith7958
@arunjithajith7958 3 жыл бұрын
Weight is base Initially base value will be 1 so we initialise weight with 1
@amudhapi6492
@amudhapi6492 3 жыл бұрын
@@arunjithajith7958 Thank u Arunjith
@muskanustad3834
@muskanustad3834 2 жыл бұрын
What about negative binary numbers🙄?
@avinashyadav8598
@avinashyadav8598 4 жыл бұрын
Program dont work for 0011
@jagugamit150
@jagugamit150 3 жыл бұрын
Same bro
@satyanarayanakoppuravuri161
@satyanarayanakoppuravuri161 5 жыл бұрын
if we give binary as 0000 ?
@krank3869
@krank3869 5 жыл бұрын
it's gonna return 0.
@hatemali4220
@hatemali4220 10 ай бұрын
Enta gamed strong
@sharuhasans9417
@sharuhasans9417 5 жыл бұрын
How 1 divd by 10 remainder will b 1
@Vinay_Yarramsetty
@Vinay_Yarramsetty 4 жыл бұрын
10) 1 (0 0 ------------- 1 I think this is the way But not like 1) 10 (10
@gourabdutta7086
@gourabdutta7086 2 жыл бұрын
10*0=0..so remainder will be 1
@donpilarsuarezgudino5160
@donpilarsuarezgudino5160 3 жыл бұрын
This code don't work in Python... Any help??
@donpilarsuarezgudino5160
@donpilarsuarezgudino5160 3 жыл бұрын
Problem solved: don`t worry any more folks
@goldendragon5371
@goldendragon5371 5 жыл бұрын
Binary to octal please bro..... >.
@Naveen-n3p1i
@Naveen-n3p1i 15 күн бұрын
Is not working all values🤷‍♂🤷‍♂🤷‍♂🤷‍♂
@reimannintegrability
@reimannintegrability Жыл бұрын
😢
@harshitha6160
@harshitha6160 6 жыл бұрын
First view, and first comment
@Kartik001arts
@Kartik001arts 2 жыл бұрын
Codes don't get executed which you teach in the window.....
@redricblue8790
@redricblue8790 2 жыл бұрын
Why did I choose software engineering? It's fucking hard
@aldolhitlercondensation1363
@aldolhitlercondensation1363 2 жыл бұрын
Hey I'm sorry you feel this way. This is actually fun if you get the concept, let me try and help. So the decimal number system (the system we naturally use) is very similar to the binary number system. Figuring out this key difference is all the logic you need to write the code. So for instance, to find the value of any decimal number we're actually multiplying each constituent digit with increasing powers of 10 for eg: 139 = 1*10^2 + 3*10^1 + 9*10^0 . It's just that we do this so naturally so that we don't usually give it a second thought. The decimal number system supports the digits [0-9] Comparing this with the very similar BINARY number system which just supports the digits 0 & 1, to get the value of a binary number we're simply multiplying the digit (bit) at each position with increasing powers of 2! for eg: 1011 represents 1 * 2^3 + 0 * 2^2 + 1 * 2^1 + 1 * 2^0 i.e the digit 11 in decimal. This is all the software engineering aspect there is. The rest is basically figuring out the fundamentals of any language to execute this. In fact, I would urge that you write your own code once you know this logic without referring the video. All you need to do that is i) knowledge of how to extract bit by bit from a given input ii) how to compute powers iii) how to use loops and conditional statements. Googling each of these gives you a clear idea of what they do. I hope i was able to help
@Deepthi_Chowdary5321
@Deepthi_Chowdary5321 Жыл бұрын
Don't worry yar. All will be good.. Better luck
Special Programs in C − Calculating Power of an Integer
10:25
Neso Academy
Рет қаралды 79 М.
Decimal to Binary and Binary to Decimal Conversion
16:17
Neso Academy
Рет қаралды 47 М.
Одну кружечку 😂❤️
00:12
Денис Кукояка
Рет қаралды 1,4 МЛН
How Many Balloons To Make A Store Fly?
00:22
MrBeast
Рет қаралды 170 МЛН
Как Я Брата ОБМАНУЛ (смешное видео, прикол, юмор, поржать)
00:59
Lamborghini vs Smoke 😱
00:38
Topper Guild
Рет қаралды 54 МЛН
Special Programs in C − Pyramid of Stars
11:06
Neso Academy
Рет қаралды 893 М.
C Program to Convert Decimal Number to Binary Number
23:45
CodeWithHarry
Рет қаралды 142 М.
Special Programs in C − Fibonacci Series
7:10
Neso Academy
Рет қаралды 233 М.
Number Systems Introduction - Decimal, Binary, Octal & Hexadecimal
10:57
The Organic Chemistry Tutor
Рет қаралды 1,8 МЛН
C++ program to convert binary to decimal number tutorial
10:46
United Top Tech
Рет қаралды 1,7 М.
31 - DECIMAL TO BINARY CONVERSION - C PROGRAMMING
15:06
Sundeep Saradhi Kanthety
Рет қаралды 126 М.
Special Programs in C − Check If The Number Is Palindrome Number
8:14
Special Programs in C− Check If The Number Is Armstrong Number
12:16
Understanding and implementing a Hash Table (in C)
24:54
Jacob Sorber
Рет қаралды 366 М.
Lecture 6: Binary & Decimal Number System
35:15
CodeHelp - by Babbar
Рет қаралды 835 М.
Одну кружечку 😂❤️
00:12
Денис Кукояка
Рет қаралды 1,4 МЛН