C Program to Convert Decimal Number to Binary Number

Поділитися
Вставка
  • Опубліковано 30 січ 2025

КОМЕНТАРІ • 402

  • @munol2524
    @munol2524 Рік тому +8

    Last semester, I made a program to convert from base 10 to base n, but I didn't know how to convert fractional numbers. I was inspired by your video title to create a program that can accept rational inputs like 32.47. I first sat down and figured out the algorithm to convert the given number's integer and fractional parts to binary on paper (using reminders and division for the integer part, and multiplication and subtraction for the fractional part). Then, I generalized it to base n and wrote the program in C.Since higher bases need more digits than 0-9, I used letters A-Z and a-z to represent higher bases.
    To handle negative values, the program will print "-" and then take the absolute value and proceed.
    Here is the program. Please feel free to read it and suggest improvements. I have tried to include extensive comments for the reader's convenience.
    #include
    #include
    char digit(int d1){//convert given number to it's corresponding digit
    if (d1 < 10)
    return(d1 + 48); //use digits [0 to 9]
    else if (d1

  • @darshan_the_admin
    @darshan_the_admin 2 роки тому +2

    Thank you bhaiyaajaan..... Aapke har eak videos Jo Maine dekhe hai, sabse kuch sikhaa huu, aur aage bhi sikungaa

  • @baki_codes
    @baki_codes 4 роки тому +2

    9:43 1100 in binary sir you are the best if you see this comment please reply and heart

  • @Aryavart..
    @Aryavart.. 4 роки тому +18

    9:45 --> here ✓ is used for division.
    2✓12 = 0, 2✓6 = 0, 2✓3 = 1, 2✓1 = 1
    Finally 12 ----> 1100.

  • @codewithharryfanchannel559
    @codewithharryfanchannel559 4 роки тому +7

    You deserve millions subscribers.

  • @StatusWorld-bp2pq
    @StatusWorld-bp2pq 4 роки тому +2

    You are my best and favourite teacher in the world

  • @kajalgoswami9530
    @kajalgoswami9530 4 роки тому +6

    Thankyou sir you teaches very well..now no confusion about this programme 😊

  • @alinamalhotra9895
    @alinamalhotra9895 4 роки тому +7

    Perfectly syncing with my syllabus

  • @darkangle9297
    @darkangle9297 3 роки тому

    I am bangladeshi.i think your youtube channel is the best for coding

  • @harshitachaurasia1246
    @harshitachaurasia1246 4 роки тому +4

    Aaj hi ye digital electronics me pdhaya gya tha😂
    Everytime u match 😁👍

  • @nikhilraj1842
    @nikhilraj1842 4 роки тому

    Harry Bhai Please give me heart btw 9:31
    12/2 = 6,0 [Quotient,Reminder]
    6/2 = 3,0,
    3/2 = 1,1
    1/2 = 0,1
    Taking all reminders 0011 Now reversing it 1100

  • @kingkie9536
    @kingkie9536 4 роки тому +1

    500k ki advance me badai.harry sir... 1, 2 din me ho to ho jaynge pakka❤💥👏

  • @subhajitghosh3867
    @subhajitghosh3867 4 роки тому +1

    I am very beginner , everything I have leaned from u. I have written the java code for this question.
    package project1;
    import java.util.Scanner;
    public class DecToBin {
    public static void main(String[] args){

    int[] arr = new int [10];
    Scanner input = new Scanner(System.in);
    System.out.println("Enter your desire Number");
    int n = input.nextInt();
    int reminder;
    int i=0;
    while(n!=0){
    reminder = n % 2;
    n = n/2;
    arr[i] = reminder;
    i++;
    }
    System.out.println("The Binary is");
    for(int j=i-1;j>=0;j--)
    {
    System.out.print(arr[j]);
    }
    System.out.println();
    }
    }

  • @t-w-s1307
    @t-w-s1307 4 роки тому +1

    harry bhai thank you for this special trick.
    mene 12 ka binary sy decimal ki h.
    the answer is=(1100)

  • @viralvideoa
    @viralvideoa 3 роки тому

    9:40 1100 thankyou bhai 😊support from rajasth

  • @siddheshmohite283
    @siddheshmohite283 2 роки тому

    bohot sahi tarikese samjha ,thanks.

  • @rs2_0_225
    @rs2_0_225 8 місяців тому

    Thanks a lot Harry sir iss code ko samjhane ke liye..

  • @hdgamer452
    @hdgamer452 4 роки тому +11

    Please make a playlist on Java
    Because in my book java is there but I can't understand
    Please make a playlist on java
    Please make a playlist on java
    Thanking you you and your work

  • @SarveshKumar-bl9in
    @SarveshKumar-bl9in Рік тому

    confusion is clear now thanks harry

  • @factodro1461
    @factodro1461 4 роки тому +1

    Our family is going to 5ook
    Congratulations 👍👍

  • @ashokbhongade3645
    @ashokbhongade3645 4 роки тому

    Thanks bhaiyaa. Mujhe is video ki bhot zarroorat thi

  • @ronakmaniya2005
    @ronakmaniya2005 5 місяців тому +1

    9.34
    For decimal to binary
    12 -> 1100

  • @loveshkumar8159
    @loveshkumar8159 4 роки тому

    hello sir m pakistan se ho mene ap ki sab se
    pahely c++ wali video dekhi tu
    mujhe os video m bohat kuch sekhne ko mila
    ............. but i need u r help.............

  • @pivotprogrammer5602
    @pivotprogrammer5602 3 роки тому +1

    Harry bhai content >= software engineer degree
    (Harry bhai ka video apune ko real kame ka software engineer Bana dega)

  • @eldrago3140
    @eldrago3140 3 роки тому +53

    The binary form of 12 will be 1100. Is it correct?

  • @rhythmmotwani6710
    @rhythmmotwani6710 2 роки тому +2

    9:40
    12 in decimal =1100 in binary

  • @hashtag_379
    @hashtag_379 Рік тому +1

    9:40 1100 12number binary 😊

  • @technobd793
    @technobd793 4 роки тому +1

    Thanks sir . And love from bangladesh

  • @drpunihealth349
    @drpunihealth349 4 роки тому

    Sir aapse jyada ummid thi es tarah ke program ke liye lekin aap sirf 10%hi samajh paaye ,,bahut jyada kathin bana diye h ,,plz aur esay method se samajhayiye

  • @walishaikh6433
    @walishaikh6433 4 роки тому

    Aap ka hi wait tha bhai pls java ka bhi bada one video banao pls🙏🙏

  • @cristinarosales1423
    @cristinarosales1423 4 роки тому +4

    Thanks for these amazing videos... Can you please make videos covering other conversions and other questions which are common in online tests for internships and jobs!!?????
    Waiting!!!

  • @prakhardhyani7111
    @prakhardhyani7111 4 роки тому +3

    We can use in question a[9-i]=rem instead of a[I] and print the normal array 😁

  • @krishnachaudhary5392
    @krishnachaudhary5392 4 роки тому +4

    Sir i have almost complited the web development playlist.... But i have basic knolwde of php so can you please make a video on how to use php as a backend..... I felt php is easy for a beginner rather than node js...... So sirplease make a video on " Using PHP In backend....

  • @uncodeyourself4473
    @uncodeyourself4473 4 роки тому

    thanks harry bhai i had been searching this kind of question for long time

  • @asparshraj9016
    @asparshraj9016 4 роки тому +1

    Bhaiya you are great and you upload informative videos...

  • @yashwanth8350
    @yashwanth8350 2 роки тому +1

    16:45
    int i=4;
    while(n) {
    rem = n%2;
    n=n/2
    a[i]= rem
    i - - ;
    }
    Can we use this instead?
    Reply if u read this comment.

  • @anshitshukla7498
    @anshitshukla7498 4 роки тому +2

    Harry bhy Zindabad 🙏

  • @RajeebLochanChand-b6b
    @RajeebLochanChand-b6b Рік тому

    for case of 0 , we can just simply initialize the array to {0}

  • @suhaasgambhir2432
    @suhaasgambhir2432 4 роки тому +2

    Hell yeahhh 🤩
    Long asked question answered 😝

  • @thankyoupwandarvindarorasi3813
    @thankyoupwandarvindarorasi3813 2 роки тому

    9:35 Ans. is 1100

  • @hiphopm7069
    @hiphopm7069 4 роки тому +1

    Sir jb mai aap ka c++, c ,ya java programming language dekhata hu to mere samjh me aata hai but pura nahi so aap daily ka 20 ya 40 minutes ka ek video uploaded kijiye

  • @aqdushumza9355
    @aqdushumza9355 2 роки тому

    Kya baat hai haris bhai❤️

  • @pratikgurav6778
    @pratikgurav6778 4 роки тому

    Sir Maine abhi 10th pass kiya hain aur me aage computers me currier Karna chata hu
    ?)To me software development karu ya soft engineering ya aur koi options hain
    ?)to main konsi site choose karu aur pcb karu ya pcm karu
    Please reply me sir U r my role moddel

  • @nancy444-v6r
    @nancy444-v6r 7 місяців тому

    9:33:-
    12 ki binary value 1100 होती है।

  • @53joyghorui17
    @53joyghorui17 3 роки тому

    harry bhai ap best ho yaar💥👏

  • @gargprince1702
    @gargprince1702 4 роки тому +1

    First comment
    Bhai react ke series b bnao please

  • @omjogani
    @omjogani 4 роки тому +1

    9:44 Binary of 12 is 1100

  • @1022-g3x
    @1022-g3x 4 роки тому

    9:45 - 1100 DONE IN MIND

  • @blackmangamer9265
    @blackmangamer9265 3 роки тому

    Thank you lot of 😀❤️

  • @manojbhavsar3872
    @manojbhavsar3872 3 роки тому +2

    9:39 12 in binary = 1100

  • @girijeshgothriwal1305
    @girijeshgothriwal1305 4 роки тому

    Bhai, SQL pe bhi bana do kuchh.. UA-cam pe bas basics hi hain.. aap python playlist jaise kuchh SQL me bhi bana do..

  • @AdarshSingh-cb5yf
    @AdarshSingh-cb5yf 4 роки тому

    Thank you sir ......
    (My great sir .......) 😍😍❤️❤️❤️❤️❤️❤️❤️❤️

  • @sandhyabhosale6328
    @sandhyabhosale6328 4 роки тому +1

    Heart dedo Harry bhai coder from Hogwarts vidhyalay Delhi

  • @codewithahmed9806
    @codewithahmed9806 4 роки тому +1

    Harry Sir Request !
    Please Make Advance Tkinter Course ......

  • @everydayamazingofficial4615
    @everydayamazingofficial4615 4 роки тому +1

    hii Harry, please make a video on number system including hexadecimal, octal number system. As soon as possible .

  • @RohanDasRD
    @RohanDasRD 4 роки тому

    Awesome bhai♥️

  • @techgourab
    @techgourab 3 роки тому +1

    9:38
    (12) :- 1100

  • @kairavgamit6354
    @kairavgamit6354 4 роки тому +1

    Nice video...sir....make many series on this type of DSA sub. Vid. and hard prob. vids.👍🏻

  • @NileshRaut6000
    @NileshRaut6000 3 роки тому

    *HW* 9:43 -----> 1100

  • @noorabdullah-dq2so
    @noorabdullah-dq2so 11 місяців тому

    time: 9:47 Answer: 1100

  • @sumitsaha6941
    @sumitsaha6941 3 роки тому

    Maza a gaya harry bhai❤

  • @monusinghrawat2911
    @monusinghrawat2911 4 роки тому

    really great sir thank you so much.........

  • @yogeshpanzade5572
    @yogeshpanzade5572 4 роки тому +4

    9:45 12 = 1100

  • @utkarshchandra8893
    @utkarshchandra8893 4 роки тому

    Thank you sir ❤❤❤

  • @jasmeetsingh8603
    @jasmeetsingh8603 4 роки тому

    Thank You for Video!

  • @hiphopm7069
    @hiphopm7069 4 роки тому +1

    2 comment sir aap suru se coading sikhaye na PLZZ sir mai siwan se hu PLZZ sir

  • @ishasinha5087
    @ishasinha5087 4 роки тому

    Thnxx for this vdo😊😊

  • @shubhamgupta3763
    @shubhamgupta3763 4 роки тому

    9:44- 12 == 1100 in binary

  • @ishasinha5087
    @ishasinha5087 4 роки тому +1

    9:32
    12-(1100)

    • @CodeWithHarry
      @CodeWithHarry  4 роки тому +1

      Correct the binary of 12 is 1100! Lots of love ❤✌

  • @yourkunal1662
    @yourkunal1662 3 місяці тому +1

    9:40 1100 binary number of 12.

  • @bamanevishwajeet
    @bamanevishwajeet 4 роки тому

    Pleased harry bhai make this program in Python also....
    Love you...

  • @mohitkwatra118
    @mohitkwatra118 Рік тому

    [09:49] answer: 1100

  • @alinamalhotra9895
    @alinamalhotra9895 4 роки тому

    9:45 Binary of 12is 1100

  • @anilagarwal5022
    @anilagarwal5022 4 роки тому

    9:45
    Binary of 12 is ---->1100

    • @CodeWithHarry
      @CodeWithHarry  4 роки тому

      Correct! Lots of love ❤✌

    • @anilagarwal5022
      @anilagarwal5022 4 роки тому

      @@CodeWithHarry Thanks bro
      Aap se hi toh sikha hai 😉

  • @soumyadeepkarmakar5702
    @soumyadeepkarmakar5702 4 роки тому

    plz make this video in hindi also. I am learining c language fromyour recent video on C.

  • @mahipalkumarwanika6053
    @mahipalkumarwanika6053 2 роки тому

    Very nice sir
    Mahipal kumar

  • @engineerbhai7642
    @engineerbhai7642 4 роки тому

    You are great sir.

  • @RokyBeastX
    @RokyBeastX 4 роки тому

    Thanks Harry Bhai

  • @HimanshuKumar-ec2hc
    @HimanshuKumar-ec2hc 3 роки тому

    thank you. very well explained.

  • @pythonenthusiast9292
    @pythonenthusiast9292 4 роки тому +5

    Can you please do a live/recorded freelancer project for a software developer , like using python and django or according to the project requirements ?

    • @raseshshetty2386
      @raseshshetty2386 4 роки тому

      python enthusiast but I don’t think anyone would get allowed by the project provider to do so...

    • @pythonenthusiast9292
      @pythonenthusiast9292 4 роки тому

      @@raseshshetty2386 maybe.. i was curious as i saw few videos on solving live freelancer projects..I asked becoz his teaching style is unique and easy to understand. Still no worries if thats not possible.

  • @prajwalkklanjewar
    @prajwalkklanjewar 4 роки тому

    Bhai is type ke conversion ke aur video banao
    Hamare concept bhi clear honge.

  • @mayankmaurya3521
    @mayankmaurya3521 4 роки тому +1

    Great video

  • @aayushmaurya1672
    @aayushmaurya1672 4 роки тому

    Bhai is list ko competitive tak leke jaoge?

  • @yashraj8584
    @yashraj8584 4 роки тому +1

    Dude, ye series placements k liye helpful rahegi kya?

    • @CodeWithHarry
      @CodeWithHarry  4 роки тому +2

      Yes bro! Such type of questions are very frequently asked in the placements!

  • @abhiaryan07
    @abhiaryan07 4 роки тому +1

    Bhai which headphones do you use.?
    Please reply.....

  • @anonymusk9397
    @anonymusk9397 4 роки тому +1

    Bro please make your data structures and algorithms series in python too.please please 🙏🙏🙏🙏🙏🙏🙏🙏

  • @hrushikeshwaghmare7261
    @hrushikeshwaghmare7261 4 роки тому

    You are great bro .

  • @soumyadeepkarmakar5702
    @soumyadeepkarmakar5702 4 роки тому

    plz make a video on which field(example: app development, web developer , data scientist) in software engg. to get high salary job also can a btech in ECE get this job by his skills.plz make a full detailes video.

  • @yuvanshibhalawat6657
    @yuvanshibhalawat6657 Рік тому

    10.07 binary conversion of 12 is 110.

  • @mahanaatma910
    @mahanaatma910 4 роки тому

    9:30 binary form of 12 is 1100

  • @drashtisahu2229
    @drashtisahu2229 4 роки тому

    12 in Binary (9:35) = 1100

  • @TOURPRM
    @TOURPRM 4 роки тому

    Awesome work sir

  • @shubhamverma865
    @shubhamverma865 4 роки тому

    Plz make video on dbms 🅾️

  • @psurya3053
    @psurya3053 4 роки тому

    sir please make vedio on complete dsa.

  • @yourwellwisher1206
    @yourwellwisher1206 4 роки тому

    Thank you harry bhai

  • @jamilahusain7244
    @jamilahusain7244 4 роки тому

    plz make ds and algo series for absolute beginners.

  • @Acoustic_ash
    @Acoustic_ash 4 роки тому

    9:46 12-> binary=1100

  • @murr4551
    @murr4551 4 роки тому +3

    Sir , Please make a video on 'How to be a data scientist in 2020' full guidelines.....I am waiting for your instruction on this topic Sir. I have seen other UA-camrs video but they are not clear enough. I am 100% sure that your guidelines will be completely useful as it has always been. Thank you Sir.

  • @satishpatra8086
    @satishpatra8086 4 роки тому

    9:50 12-
    1100

  • @muhammadsameer9161
    @muhammadsameer9161 4 роки тому

    9:45
    decimal number into binary
    12 = 1100