Any base to Decimal | Solution

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 ธ.ค. 2024

ความคิดเห็น • 18

  • @shubhamsingh4701
    @shubhamsingh4701 2 ปีที่แล้ว +1

    for the number which we want to convert we need to multiply by that number number base and for base to be which we want to convert we need to divide by that ! Simple
    eg 673 base 10 to base 8 then divide by 8 get the value and multiply by 10 rase to pow++;

  • @debanjanpanigrahi4099
    @debanjanpanigrahi4099 4 ปีที่แล้ว +2

    sir will it work correctly for hex numbers?

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว +1

      nahi bro. 10 base tak he chalega.

  • @biswajeet9826
    @biswajeet9826 3 หลายเดือนก่อน

    Thanks

  • @sakshiaggarwal6199
    @sakshiaggarwal6199 4 ปีที่แล้ว +2

    For hexadecimal we need to collect 16 ke power.

  • @shubhamnarayan5794
    @shubhamnarayan5794 2 ปีที่แล้ว

    Sir can we use math.pow and solve this

  • @sakshiaggarwal6199
    @sakshiaggarwal6199 4 ปีที่แล้ว

    Thank you so much sir🙏

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว +1

      Thankyou beta for being our constant supporter🙏
      If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
      Keep learning and keep loving Pepcoding😊

    • @sakshiaggarwal6199
      @sakshiaggarwal6199 4 ปีที่แล้ว

      @@Pepcoding done sir😁

  • @sarojsharma-pw3iz
    @sarojsharma-pw3iz 3 ปีที่แล้ว

    Thank you sir

    • @Pepcoding
      @Pepcoding  3 ปีที่แล้ว

      Thankyou beta!
      I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem.
      If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

  • @loserfruit9663
    @loserfruit9663 3 ปีที่แล้ว

    Perfect

  • @TheBlackwindOriginals
    @TheBlackwindOriginals 4 ปีที่แล้ว

    Sir question clear nhi ho raha...base 8 kaise pata chala??? confused

    • @RahulGupta-ki8hn
      @RahulGupta-ki8hn 3 ปีที่แล้ว

      8 is taken just for example you can try with base 2 also.

  • @pratapjavasingh3239
    @pratapjavasingh3239 4 ปีที่แล้ว

    Gurudev jab bhi concept aap explain karte ho paint se to kripya kar ke code ko bhi laa kar explain kar diya karo ishe code ke follow ko relate karne main aashan ho jayega warna speed kam kar ke TH-cam ka multiple time suna aur samjhna parta hai 🙏

  • @ujjwaljain9780
    @ujjwaljain9780 4 ปีที่แล้ว

    public static int getValueIndecimal(int n, int b) {
    // write your code here
    int sum = 0;
    int i = 0;
    while (n > 0) {
    int dig = n % 10;
    n = n / 10;
    sum += dig * (Math.pow(b, i));
    i++;
    }
    return sum;
    }