5.2 How to reverse a number | Check if a number is Prime or Armstrong | C++ Placement Course | # 5.2

Sdílet
Vložit
  • čas přidán 19. 10. 2020
  • Apni Kaksha Instagram : / apnikaksha
    Apni Kaksha Telegram : t.me/apnikakshaofficial
    Notes of this video : drive.google.com/file/d/1TVB8...
    Link to Complete C++ Placement Course : • 1. Introduction to C++...
    #C++ #Programming. #PlacementCourse

Komentáře • 1,1K

  • @prathamvyas8342
    @prathamvyas8342 Před 3 lety +338

    There is problem when you use pow() function, this is happening because the return type of pow() is float and it returns numbers like 152.9999 but 0.9999 is truncated as we are storing it as an integer.
    -> USE
    sum += round(pow(lastdigit, 3));
    round() will round 152.9999 to 153 and you will get the correct output.

  • @appexplored7678
    @appexplored7678 Před 3 lety +111

    Aman Dhattarwal is going to get THE BHARAT RATNA for this revolution.
    ❤️

  • @ally6718
    @ally6718 Před 2 lety +13

    1. Prime or not
    2. Reverse a number
    3. Check the number is Armstrong or not
    It's an amazing depthful content ...series also
    Lots of love to all of you 💝

  • @monikajain6237
    @monikajain6237 Před 3 lety +76

    I don't have a real brother or sister.But when I watched your video I don't realised have brother or sister.. you are the brother of millions.
    Thank you so much

    • @Arceus948
      @Arceus948 Před 3 lety +8

      She is sister 😅😅😂😂. And she is our teacher so pls say Mam 😤😤

    • @monikajain6237
      @monikajain6237 Před 3 lety

      @@Arceus948 I am saying to Aman dhattarwal bhaiya

    • @rudranarayandash9981
      @rudranarayandash9981 Před 3 lety +3

      @@monikajain6237 People with a normal mind got what you meant. I share your feeling.

    • @monikajain6237
      @monikajain6237 Před 3 lety

      @@rudranarayandash9981 thanks

    • @balbhadra_
      @balbhadra_ Před 3 lety

      @@monikajain6237 i am your brother sister don't fell lonely i also don't have real sister i know the feeling

  • @AritraRoyRup
    @AritraRoyRup Před 3 lety +42

    The value that pow() function returns is in decimal form. So, we should use float/double data type for initializing the 'sum' variable. Otherwise, the program for Armstrong number fails in my case probably, due to type casting error. Please look into it.

  • @biyyalaharikrishna381
    @biyyalaharikrishna381 Před 3 lety +40

    Nice explantion mam. but small correction Armstrong number is sum of each digit raised to power of no of digits. (not 3).

  • @HawkingMerchant
    @HawkingMerchant Před 2 lety +1

    we can also do i*i

  • @kushalappaca5324
    @kushalappaca5324 Před 3 lety +13

    Small correction:
    In armstrong number it's not cube always... That depends on the "number of digits in a number"... If the number of digits in a number is 4, then all the digits must be raised to the power of 4 and then added....
    Ex : 153 is an armstrong number because: 1^3+5^3+3^3=153
    Ex2: 1634 is also armstrong no. because 1^4+6^4+3^4+4^4 = 1634 (notice the digits are raised to fourth power)
    Similarly 5 digit armstrong number will be raised to 5th power and then added.

    • @dipeshverma29
      @dipeshverma29 Před 3 lety +1

      yahi dekhne comment m aaya tha.

    • @basityar1494
      @basityar1494 Před rokem

      Absolutely u are right....

    • @serenityxalt
      @serenityxalt Před rokem +1

      //add and extra loop before the while loop for sum like this.....
      int g=n;
      while(g>0){
      int pc=g%10;
      if (pc>0){
      x=x+1;
      }
      g=g/10;
      }
      //then pass the variable x at the place of 3 in pow() function.

  • @PANKAJKUMAR-fe8zn
    @PANKAJKUMAR-fe8zn Před 3 lety +30

    Please upload a Interview series of all your 7 teammates. We will be happy to know their thought process about programming and ofcourse they are also same minded people like you...we will happy to know about them and we will be feel more connected with them as like with u.

  • @samarthsakhare7058
    @samarthsakhare7058 Před 2 lety +5

    We can also do this using String
    #include
    using namespace std;
    void reverse(string s){
    string res = "";
    for(int i=s.length();i>=0;i--){
    res += s[i];
    }
    cout

  • @shubhangtiwari4315
    @shubhangtiwari4315 Před 3 lety +8

    It can also be done as follows :
    while(n>0){
    int lastdigit = n%10;
    cout

    • @thedeepakmor
      @thedeepakmor Před 3 lety

      we have to store that reverse not just to print

  • @TheChamp001
    @TheChamp001 Před 3 lety +1

    You are doing great.. don't worry brother
    God is with you. May God bless you always..... Keep trying.... Your content is great...... You deserve billions of views and one day you will achieve billions of views❤️❤️❤️

  • @UnKnown-id7ih
    @UnKnown-id7ih Před 3 lety +6

    Your way of teaching is mind blowing thanku didi❤

  • @RiteshNEVERUNIFORM
    @RiteshNEVERUNIFORM Před 2 lety +25

    We can still improve our Prime number function by eliminating even numbers. Since if n is even then it's not prime right away. So we know only numbers > 2 which are odd can be prime numbers so again here we don't need to check for every number. We can skip checking with even numbers by i=i+2 startingfrom i =3. So half Numbers are eliminated

    • @malayasahu817
      @malayasahu817 Před rokem

      czcams.com/video/aU2WT2OUeww/video.html

    • @sushmitamandal1677
      @sushmitamandal1677 Před rokem

      Hey is the prime number problem running if I take input as 4 I am not understanding the way how it will work?

  • @bijjasaikiran581
    @bijjasaikiran581 Před 3 lety +1

    Aman bhaiya jo bolte hai woh karke dikate hai blessed to have u bhaiya❤

  • @anshdholakia714
    @anshdholakia714 Před 3 lety +4

    for people who want to make the prime number code in an efficient way, the prime number code should have a for loop that goes from 2 to the conditions were i*i

  • @ragingshadow7420
    @ragingshadow7420 Před 3 lety +9

    153 is an armstrong number but when i'm running this code it's printing non-armstrong number but 370 is showing as an armstrong number.

  • @therak4392
    @therak4392 Před 3 lety +82

    I just love the beats at the beginning and at the ending of the video ....!!!

  • @vrandakansal5940
    @vrandakansal5940 Před 3 lety +2

    The way of teaching is amazing..
    Great work di..😊

  • @rajpawar9541
    @rajpawar9541 Před 3 lety +3

    Thank You very much, mam and aman bhaiya
    i understand everything from 1st video.

  • @rupalihaldiya
    @rupalihaldiya Před 3 lety +6

    i found this randomly, and this is like a jackpot ; D

  • @ayushabrol1406
    @ayushabrol1406 Před 3 lety +12

    For those who are getting sum as 152, add the following inside the while loop after the statement n=n/10;
    if (n < 1)
    {
    sum = sum + pow(1, 3);
    }

  • @sambhavsharma2780
    @sambhavsharma2780 Před 2 lety +2

    There is a problem in Prime number algo that is if you give 1 as a input then it will tell it is a prime number because you set flag ==0 and since n == 1 then for loop never excute so we have to check if n==1 || n==0 then set the flag == 1 before for loop. or you can set if n < 2 then flag == 1.

  • @rajeshjha6801
    @rajeshjha6801 Před 3 lety +8

    Bhaiyya please upload a doubt session...
    As a learner I have some doubts in few questions

  • @Study-cf5dx
    @Study-cf5dx Před rokem +9

    Great but small correction . Armstrongis a number that is equal to the sum of its own digits each raised to the power of the number of digits in the number.
    For example:
    (1) 1634 in that example the power will be 4 . Bcz the total digits is 4 .

  • @farhatali307
    @farhatali307 Před 3 lety +43

    didi i wrote the same ditto code for amstrong number on visual studio but its not working plz help what would have gone wrong

    • @monidipbakli3670
      @monidipbakli3670 Před 3 lety +3

      same...the same code of the notes is showing opposite result in vs code

    • @nishabisht2804
      @nishabisht2804 Před 3 lety +28

      Try using ..sum= sum+(lastdigit*lastdigit*lastdigit) in place of.. sum+=pow(lastdigit, 3)..
      Hope it will solve ur prblm..

    • @thewhitene9746
      @thewhitene9746 Před 2 lety +5

      Yaar ye interpreter ke alag hi nakhre hote he 😭

    • @HimanshuSharma-oo9fc
      @HimanshuSharma-oo9fc Před 2 lety +2

      Mera to bhai prime number wla code bhi different output de raha hai

    • @priyanshubasu6977
      @priyanshubasu6977 Před 2 lety

      Yes same for me also

  • @baymax6430
    @baymax6430 Před 2 lety +2

    Reversing a num :
    Int main() {
    Int num, quo ;
    cin>>num;
    While(num>0){
    cout

    • @kyuu_shi_
      @kyuu_shi_ Před 2 lety

      with this code if you have input 154000, it'll print 000451

  • @prajjawalkushwaha4352
    @prajjawalkushwaha4352 Před 3 lety +2

    just a correction--- an armstrong no. is that which is the sum of digits raised to the power of number of digits to give back the same number, not everytime the digits are raised to the power three. the digits are raised to the power of no. of digits.

  • @mohitjariwala8011
    @mohitjariwala8011 Před 3 lety +3

    Reverse was explained so brilliantly

  • @sayanghosh6996
    @sayanghosh6996 Před 3 lety +68

    8:00 this definition is incorrect. A n-digit number is armstrong if sum of the n-th power of each digit is equal to the number. For three digit numbers its cube, for two digit numbers it should be square, etc.

    • @biswadipmandal4529
      @biswadipmandal4529 Před 3 lety +3

      Yeah that's what I was thinking too..😅

    • @manishkumarparmar412
      @manishkumarparmar412 Před 3 lety +10

      Sab tareef hi kar rahe hai, particular video k bare me koi nahi bol raha

    • @avanishsingh7381
      @avanishsingh7381 Před 3 lety +1

      Yup thts a prblm

    • @shreyashraj
      @shreyashraj Před 3 lety +4

      Actually there are two definitions of armstrong no. If you google you will find out thatt def. is correct in the video.

    • @drishti1483
      @drishti1483 Před 3 lety +1

      What you are talking about are Narcissistic numbers...not Armstrong Numbers

  • @harshitlegend2817
    @harshitlegend2817 Před 3 lety +1

    DIDI was the point which forced me to read comments :)

  • @atin_jagotra
    @atin_jagotra Před 3 lety +1

    Thankyou for such great content and so easy and informative.

  • @sagartamrakar1919
    @sagartamrakar1919 Před 3 lety +3

    The way you teach is awesome.

  • @raviyaduvanshi9253
    @raviyaduvanshi9253 Před 3 lety +5

    Bhaiya kya ye c++ course begginers dekh sakte hai?

  • @pallavbag6306
    @pallavbag6306 Před 3 lety +2

    Simply GREAT!❤️

  • @JaySir_4U
    @JaySir_4U Před 7 měsíci +1

    mam I am 15 year old and I giving you a like because I learn about "pow" In this video thank you so much🙏🙏

  • @anshuljohari89
    @anshuljohari89 Před 3 lety +5

    Bool flag kya h ?

    • @Hneqijnes
      @Hneqijnes Před 13 dny

      Bool is a data type which stores two values either 0/1 or else true or false

  • @pretty4436
    @pretty4436 Před 3 lety +37

    *Please🙏 introduce with your 7 Member Pro team 😀*

    • @anonymous7860
      @anonymous7860 Před 3 lety +1

      www.change.org/p/prime-minister-narendra-modi-remove-the-caste-based-reservation-system-2?recruiter=1157950432&
      सारे सवर्ण भाई, कृपया इस पेटिशन को शाइन करे और आरक्षण के खिलाफ अपनी आवाज़ बुलंद करे।
      जय सवर्ण एकता।
      जय चित्रगुप्त भगवान..

    • @pretty4436
      @pretty4436 Před 3 lety

      @@anonymous7860 bro 🤜 I'm not a fool

    • @anonymous7860
      @anonymous7860 Před 3 lety

      @@pretty4436 are you from general category?

    • @mohammedsayeed330
      @mohammedsayeed330 Před 3 lety

      I am waiting for this

    • @falgunipatel6721
      @falgunipatel6721 Před 2 lety

      #easycomputerprogramming

  • @pratikraj_5888
    @pratikraj_5888 Před 3 lety +1

    Love your teaching sister 🙏and thanks Bhaiya for making Video's 🎉.

  • @shrishtikumari7201
    @shrishtikumari7201 Před 3 lety +2

    Use round(pow(lastdigit, 3)); if power function is giving wrong output.

    • @ddhruvarora
      @ddhruvarora Před 3 lety +1

      Thanks for this, my program worked fine but with 153 it showed that it's not Armstrong, after using round () it worked.

  • @groots17
    @groots17 Před 3 lety +5

    Hey, I'm facing an error in Armstrong Number Code.
    Error :- I'm Getting always "Non Armstrong Number",
    Code :-
    int n;
    cin >> n;
    int sum = 0;
    int originaln = n;
    while(n > 0) {
    int lastDigit = n%10;
    sum+= pow(lastDigit,3);
    n=n/10;
    }
    if(sum == originaln) {
    cout

  • @kedardeshmukh7173
    @kedardeshmukh7173 Před 3 lety +8

    Hello Sir Please make a course on Graphic design

  • @theyoutuber778
    @theyoutuber778 Před rokem

    It's far better to watch the solution and then do it on your own first, than sitting puzzled all day long and coming up with a program that is really bad.
    But if it works and you understand it, then you can improve your program with the one she has given, which is like really amazing.

  • @harshkumarsharma6863
    @harshkumarsharma6863 Před 3 lety +1

    Thank You For All These Tutorials.

  • @cyanider069
    @cyanider069 Před 3 lety +17

    If 153 shows "Not an Armstrong Number" try round(pow(lastdigit, 3))

  • @GemoisLive
    @GemoisLive Před 3 lety +7

    sir, at the end of the video brain teaser daldete toh aur maja aata aur quiz related to that topic....thanks alot

  • @RahulRajput-yn5tz
    @RahulRajput-yn5tz Před 2 lety +1

    correct program for prime numbers.
    #include
    #include
    using namespace std;
    int main(){
    int n;
    coutn;
    bool flag=0;
    for(int i=2;i

  • @Pratyush_Srivastava24
    @Pratyush_Srivastava24 Před 3 lety +5

    Wow today teaching style was very much similar to Aman bhaia teaches physics🔥 .
    👍👍👇👇👇

    • @anonymous7860
      @anonymous7860 Před 3 lety

      www.change.org/p/prime-minister-narendra-modi-remove-the-caste-based-reservation-system-2?recruiter=1157950432&
      सारे सवर्ण भाई, कृपया इस पेटिशन को शाइन करे और आरक्षण के खिलाफ अपनी आवाज़ बुलंद करे।
      जय सवर्ण एकता।
      जय चित्रगुप्त भगवान..।।

  • @akay5797
    @akay5797 Před 3 lety +6

    Anyone who sees HATE words against BHAIYA just remember one thing that those comments writers are not students , they are fake people who dont want BHAIYA to grow . So ignore such comments and just think as a student that how much is BHAIYA doing for us.
    BHAIYA PLEASE APNE HAR VIDEO PAR AD DAALO WE WANT TO SUPPORT YOU ❤❤❤

  • @nikunjgarg3754
    @nikunjgarg3754 Před 3 lety +6

    Hello didi, I don't know why this happened but in the armstrong program, I had to take sum as a double. As an int it was showing 153 as not armstrong. ANyone else?

  • @akashyadavrpl
    @akashyadavrpl Před 3 lety

    Thanks a lot di....for explaining like this❤️

  • @allaboutinformation963

    Didi(appi)
    Thanks for clarifying my confusion about prime numbers

  • @kartikeyadubey1266
    @kartikeyadubey1266 Před 3 lety +25

    It is like a blessing for me that I got to know about this C++ course. Really a very nice method and content.

  • @vivekshenoy6335
    @vivekshenoy6335 Před 3 lety +7

    Thank you Aman Dhattarwal and team for these excellent lectures. I have a query though - why are variables being defined inside the loop? Is this mistake being made on purpose to demonstrate programming best practices later in the course?
    Thank you once again and keep up your good work!

  • @cooldamager8442
    @cooldamager8442 Před 2 lety

    For prime number programme
    When we put n=4 ,25
    In output, instead of non prime it shows prime number ........ By sqrt(n)...

  • @chaitanyapatil2068
    @chaitanyapatil2068 Před 3 lety +1

    I LOVED THE REVERSE NUMBER PROGRAM SO COOOLLLL!!!!!!!!!

  • @factandlogic6534
    @factandlogic6534 Před 3 lety +4

    this is my first time that I teaching with 'DIDI'

  • @Harshp062
    @Harshp062 Před 3 lety +5

    mem your commands on c++ is decent, you just type the code in your flow and never have to check back for errors. because error होती ही नही है code में। 👌👌👌

  • @SunitaDevi-hd6dn
    @SunitaDevi-hd6dn Před 3 lety

    You are too good bhaiya.....
    Hats off to you...

  • @abhinnsoni5437
    @abhinnsoni5437 Před 2 lety

    pow( ) will not work here , since sum is an int type and pow() returns double value . so either make sum as double or use sum+= (int)(pow(lastdigit,3)+0.5) if u want to take sum as integer type.

  • @satyampathak9133
    @satyampathak9133 Před 3 lety +9

    Grt work bro❤️❤️❤️❤️❤️
    U r inspiration of thousands of people 🔥🔥🔥🔥

  • @kashifamir4795
    @kashifamir4795 Před 3 lety +4

    in the condition of finding the prime ..,i dont think so becz. lets say Consider that the square root of 14 is about 3.74 but 14 has 7 as a prime factor. Also consider that any prime number such as 2 is its own (only) prime factor, and any number greater than 1 is greater than its square root. The theorem you have stated is incorrect: 25 has no prime factor less than 5, and 3 has no prime factor less than 1.732; however, it is true that every composite number has a prime factor less than or equal to its square root..
    plz correct me if i am wrong

  • @anujbhure7479
    @anujbhure7479 Před 3 lety

    Bhai aap bohot acchaa kaam kr re ho , god bless u.😁

  • @saurabhyaduvanshi1223
    @saurabhyaduvanshi1223 Před 3 lety

    Aman bhaiya u r my inspiration
    Lots of love bhaiya♥️

  • @PiyushKumar-zy3zu
    @PiyushKumar-zy3zu Před 3 lety +28

    Plz upload class 12 lectures specially of physics ....

    • @ApnaCollegeOfficial
      @ApnaCollegeOfficial  Před 3 lety +53

      I myself will be uploading Class 12 Physics but right now I am busy managing other courses. We will be first uploading
      - Notes of Complete Chemistry, Physics and Maths.
      -Complete syllabus video lectures of Class 12 Maths, Chem, Eco, Python will be uploaded before board exams

    • @PiyushKumar-zy3zu
      @PiyushKumar-zy3zu Před 3 lety +2

      @@ApnaCollegeOfficial ok bhaiya❤❤❤

    • @neelampatil7821
      @neelampatil7821 Před 3 lety +1

      @@ApnaCollegeOfficial ok thnx bhaiya❤️❤️❤️

    • @aaryanale9538
      @aaryanale9538 Před 3 lety

      @@ApnaCollegeOfficial physics courses on this channel? I thought you'd continue marathon for mechanics...(rotation and SHM) will there be more marathons?

    • @eternity44
      @eternity44 Před 3 lety +1

      @@aaryanale9538 wait first let Aman Bhaiya complete class 12 syllabus for BOARD EXAMS

  • @Abhishek-ks6ns
    @Abhishek-ks6ns Před 3 lety +3

    @Apna college , didi apka name Urvi Goel hena , Kay mene sahi decode he 😁😁 apse coding and decoding dono sikhane ko mil rahi he ❤️

  • @lalithnarayanan1979
    @lalithnarayanan1979 Před 2 lety +1

    correct and no error code for armstrong number:
    #include
    #include
    using namespace std;
    int main()
    {
    int n;
    cin>>n;
    int sum=0;
    int original=n;
    int power=log10(n)+1;
    while(n>0)
    {
    int lastdigit=n%10;
    sum+=round(pow(lastdigit,power));
    n/=10;
    }
    if(original==sum)
    cout

    • @karanchandak5667
      @karanchandak5667 Před 2 lety +1

      hey bro, can explain why you use int power=log10(n)+1; and round(pow(lastdigit,power));??

  • @nikhilrichhariya6517
    @nikhilrichhariya6517 Před 2 lety

    Armstrong number is a number such that its digits to the power number of digits in it is equat to itself not the cube, its true with three digit numbers only as number of digits are three. Eg 1634 is an armstrong number because 1 + 1296 +81 + 256 = 1634.

  • @anvithaki8935
    @anvithaki8935 Před 3 lety +8

    I don't know how I found my way here to this channel but this thing is the real deal it's way way more better than my college where I am studying right now but bad thing is that it would be awesome if I found it when I was in my first year of engineering I am currently in my 3rd year feeling a bit low 😟 but the content here is 🔥

    • @neffex76
      @neffex76 Před 3 lety +1

      how would have this course changed u if you had this in 1st yearbro,im ini 2nd year ,

    • @abhaypanchal2206
      @abhaypanchal2206 Před 2 lety

      please reply ash prospect's question .... you have welgth of experince , don't ruin it !

    • @anvithaki8935
      @anvithaki8935 Před 2 lety +1

      @@abhaypanchal2206 the total b.tech course maybe 4 years but first 3 years defines everything durring your final year you will be having lot of things to do like project work , prepare for aptitude tests for attending campus selections etc ...like tcs nqt exam ,wipro exam for job selections other exams maybe like gate you won't have time for learning much because of the stress and all things happing around you
      I literally wasted my first 2 years of b.tech just fooling around playing pubg and all but now I have not yet completely learned anything perfectly I still have few things to do in DSA it's still a bit complex
      My recommendation would be
      Learn a programming language along with DSA in first 2 years and in ur 3rd year sharpen ur skills and checkout some frontend and database development and durring ur 4th year put ur skills into use and finally get a good job ,,, maintain atleast 70% aggregate for ur total b.tech , practice speaking English u will be all good.

    • @rameshmalhotra9525
      @rameshmalhotra9525 Před 2 lety

      czcams.com/video/5FsIa4Mp3ho/video.html

  • @lekhshisodiya6094
    @lekhshisodiya6094 Před 2 lety +11

    Played a little with Armstrong example:
    *TO FIND NUMBERS OF ARMSTRONG NUMBERS BTEWEEN TWO NUMBERS(GIVEN BY USER)*
    #include
    #include
    using namespace std;
    void armstrong(int);
    int main()
    {
    int u,l;
    coutu>>l;
    for (int i = u; i >= l ; i--)
    {armstrong(i);}
    return 0;
    }
    void armstrong(int n)
    {
    int arm,a=n,l;
    arm=l=0;
    while(n>0)
    { l= n%10;
    arm = arm + pow(l,3);
    n = n/10;
    }
    if (arm==a) cout

  • @Attendance75
    @Attendance75 Před 2 lety

    If uh even need to print the zeroes of the end use this.
    #include
    using namespace std;
    int main() {
    int n;
    cin>>n;
    int reverse=0;
    while(n>0){
    int lastdigit= n%10;
    reverse = reverse*10 + lastdigit;
    n=n/10;
    if (lastdigit==0)
    cout

  • @SHUBHAM23P
    @SHUBHAM23P Před 3 lety +1

    Thank you so much for your efforts

  • @shivasaipothuganti1069
    @shivasaipothuganti1069 Před 3 lety +6

    if number is negative , reverse algorithm wont work

    • @gamoholic7653
      @gamoholic7653 Před 3 lety +2

      we can use the absolute value of n and at last determine the sign of the reverse value.

  • @pretty4436
    @pretty4436 Před 3 lety +4

    *What is the background music ?🔥🔥*

  • @09avishkargaikwad71
    @09avishkargaikwad71 Před rokem

    Mam for 1 there must be some condition.As 1 is not a prime number..
    Program will give 1 as prime number because it will not enter into for loop and value of flag will not change...
    Code: if (num==1)
    { Count

  • @adityatrehan9838
    @adityatrehan9838 Před 3 lety +1

    #include
    using namespace std;
    int main()
    {
    Everyone - theek hai
    Apni didi - tchick aee (7:33)
    return 0;
    }

  • @thunderbolt9624
    @thunderbolt9624 Před 3 lety +7

    in pow() we have to use digit raised to the power of n,but here its taken 3 by default. Content is too good thanks to apna college ^o^

    • @sreedharreddyabbidi5374
      @sreedharreddyabbidi5374 Před 2 lety

      U are right we have to find number of digits also 👍

    • @serenityxalt
      @serenityxalt Před rokem

      //add and extra loop before the while loop for sum like this.....
      int g=n;
      while(g>0){
      int pc=g%10;
      if (pc>0){
      x=x+1;
      }
      g=g/10;
      }
      //then pass the variable x at the place of 3 in pow() function.

  • @shahhet8354
    @shahhet8354 Před 3 lety +12

    Hi, ma'am as well as sir I am het and I am having 2 question in my mind:1)- when will the web development course will start (date if u can)and 2)-In how many months it will take for u to complete the web development course :)
    Thank you

  • @iamproud2646
    @iamproud2646 Před 3 lety +1

    we cant put sqrt in for loop because for 4 rooted to 2 and it will declare it as a prime no;

  • @satyamdadsena3480
    @satyamdadsena3480 Před 3 lety +1

    very nice teaching mam...... Awesome👌👌🔥🔥

  • @parbhatkataria9110
    @parbhatkataria9110 Před 3 lety +15

    di, please explain pascal's triangle in your next video🙏🙏🙏🙏

    • @Aman-jl7kp
      @Aman-jl7kp Před 3 lety

      Establish a relation between nCr and nC(r-1) and you will get it done

    • @chetanraghavv
      @chetanraghavv Před 3 lety

      It can be easily done using recursion,
      In Pascal's triangle
      Level 1: 1 can be written as 0C0 i.e. when n=0 and r=0 in the combinational formula nCr
      Level 2: 1 (can be written as 1C0), 1 (can be written as 1C1)
      Level 3: 1 (2C0), 2 (2C1), 1 (2C2)
      Level 4: 1 (3C0), 3 (3C1), 3 (3C2), 1 (3C3)
      .... And so on
      Now by seeing the figure we can easily find out that middle terms of each level are found by adding the two numbers just above them and also all the leftmost and righmost elements in each level is 1.
      Like this
      1
      / \
      1 + 1
      / \ / \
      1 + 2 + 1
      / \ / \ / \
      1 + 3 + 3 + 1
      .........
      2 is obtained from 1+1
      Or we can say, 2C1 is obtained from 1C0+1C1
      Which is actually a formula, that says
      nCr = n-1 C r + n-1 C r-1
      This becomes our recursive statement...
      Function can be written as:
      int C(int n, int r)
      {
      if (r==0 || r==n)
      return 1; //as nC0=nCn=1
      else
      return C(n-1,r) + C(n-1,r-1);
      }

  • @ravenmehta2080
    @ravenmehta2080 Před 3 lety +15

    Reverse number in python lol:
    print(int(input()[::-1]))

  • @sg2537
    @sg2537 Před 3 lety

    This is what the student wants....Perfect education and education system

  • @priyankataak5394
    @priyankataak5394 Před 2 lety +2

    I'm asking to you in the 'Reverse number concept'
    The problem is it doesn't really return the reverse number for numbers ending with 0.
    For example 5460 becomes 645.
    And second, I took input greater than 9 digits then the output showing some garbage value.
    How to handle?

    • @swarupkumarbhuyan8831
      @swarupkumarbhuyan8831 Před 2 lety

      Int main() {
      Int num, quo ;
      cin>>num;
      While(num>0){
      cout

    • @priyankataak5394
      @priyankataak5394 Před 2 lety

      @@swarupkumarbhuyan8831 Yeah, this is working but aapne digits ko print krne ka program bnaya hai lekin yaha print nahi kiya gya yaha ek number ko actual mein pahle reverse kiya gya hai aur phir baad mein print kiya gya hai.

    • @darexteel3096
      @darexteel3096 Před 2 lety

      @@priyankataak5394 I didn't get ur point .
      Like , Hume toh finally reversed number chaiye na , then what's the issue

  • @beacoder1221
    @beacoder1221 Před 3 lety +10

    much easier code for prime and non-prime number is
    #include
    using namespace std;
    int main() {
    int n;
    cin>>n;
    int i;
    for(i = 2; i < n; i++){
    if(n%i == 0){
    cout

    • @joetonyaashish7985
      @joetonyaashish7985 Před 3 lety

      this has been given in a previous video bro

    • @joetonyaashish7985
      @joetonyaashish7985 Před 3 lety

      @Yath YT please put that if(i==root n +1) inside the for loop. I think it should work after that.

    • @joetonyaashish7985
      @joetonyaashish7985 Před 3 lety

      @Yath YT #include
      #include
      using namespace std;
      int main()
      {
      int n,i;
      cout

    • @joetonyaashish7985
      @joetonyaashish7985 Před 3 lety

      @Yath YT I have used ur code and made some minor changes. this works.
      Just use an else statement in the end :D

    • @joetonyaashish7985
      @joetonyaashish7985 Před 3 lety

      @Yath YT Also as to why ur code didn't work..
      I think the reason is in for loop u have said that i moves from 2 to root n.
      So 'i' will go only till root n and NOT (root n + 1)
      thus u can't equate i to (rootn+1).

  • @vedantpatel8556
    @vedantpatel8556 Před 3 lety +4

    What is bool flag ? And how it's work?
    Please Didi explain the concept when new parameters is in use

    • @khurshidjahan9102
      @khurshidjahan9102 Před 3 lety +2

      It's a function that returns only two either two of value, that is true or false.

    • @adtech6706
      @adtech6706 Před 3 lety +2

      'bool' is Data Type in C/C++ and other languages. that returns "True(1) or false(0)" It will store 1 byte in a memory either 1 or 0.

  • @karanveer43f
    @karanveer43f Před 3 lety

    didi awsome videos and explaination;;crdits to you i enjoy coding and am able to hard qstns with ease

  • @chinmay.sharma
    @chinmay.sharma Před 3 lety +1

    Armstrong number is sum of nth powers of individual digits where n is number of digits in given number not cube....

  • @pallavikumari1684
    @pallavikumari1684 Před 3 lety +3

    🥺😭bhaiya thode paap bhi krlo nhi to bhagwan ban jaoge 😭😭♥️♥️♥️♥️

  • @ganeshbansode9380
    @ganeshbansode9380 Před 3 lety +3

    I was having problem with 153 it was showing not armstrong as it is calculating pow(5,3) as 124.999 for interger it is 124 so use "float sum ;" , it will solve the problem .

    • @sathvikreddy4807
      @sathvikreddy4807 Před 2 lety

      god, thanks to you, i have been having the same difficulty and scratching my head from morning

    • @ganeshbansode9380
      @ganeshbansode9380 Před 2 lety +1

      @@sathvikreddy4807 Happy to hear you...

    • @sathvikreddy4807
      @sathvikreddy4807 Před 2 lety

      @@ganeshbansode9380 if i may ask, did you complete the whole playlist?

  • @rudranarayandash9981
    @rudranarayandash9981 Před 3 lety +1

    Them:-What are you doing?
    Me:-looking at a Masterpiece!
    This course is legit amazing!!!

  • @thatarif
    @thatarif Před 3 lety

    Code for checking Armstrong number for any number of digits not just 3 digits numbers... like 1634, 54748, etc.
    #include
    #include
    using namespace std;
    int main(){
    int num, originalNum, numberOfDigit=0, power, remainder, sum = 0;
    cin>>num;
    originalNum=num;

    //for extracting number of digits
    while(originalNum>0){
    originalNum/=10;
    ++numberOfDigit;
    }
    originalNum=num;
    while(originalNum>0){
    remainder = originalNum%10;
    power = round(pow(remainder,numberOfDigit));
    sum += power;
    originalNum/=10;
    }
    if(sum==num){
    cout

  • @akshatvyas2594
    @akshatvyas2594 Před 3 lety +3

    How do you compile and run the code?

  • @namangadia9056
    @namangadia9056 Před 3 lety +9

    Just some constructive criticism
    You guys are using animation for simple and not so important parts of the videos like title topic etc.
    You guys aren’t implementing animation in the main explaining bit (at least in this video)
    See the 5:12 part, it’s just the part where a total newbie will have to watch multiple times to understand and that is not something you guys are targeting and in this part, the animation would have really helped.
    Also, I think you should at least clear some air because people are just going total andh bakth in comments, generally, it’s a good thing for the creator to have an audience like this but these are just students, just don’t use them in that way.
    I want this to be good that's why I am criticizing it, agar itni mehanat karna ka baad maza nahi aya tho mehanat karna ka maza bhi khatam hona laag jata haa.

    • @sumonkumar3356
      @sumonkumar3356 Před 3 lety

      bhai tune sahi bola. Reversing a number me bhi agar animation laga ke square root ko samjhate tab aur achha hota. Faltu me chotti cheez pe kyu animators ka dimag kharab karne ka

    • @harshitbhalla7416
      @harshitbhalla7416 Před 3 lety

      I agree but the part where one understands how dividing gives you digit, has already been shown clearly using animations in the previous video (the bit where di explains how you can get a number by dividing again and again and then if you take the remainders in reverse order, you'll get the number itself. However, if you look at the numbers not in the reverse order, you'll get what you're looking for in the question you mentioned)

    • @realshine2066
      @realshine2066 Před 3 lety

      Yes you told correct
      Ans sir please try to improve this problem

  • @gautampatel8125
    @gautampatel8125 Před 2 lety

    This works for only 3 digit or lower Armstrong number. 1634 is an armstrong number but this program will not give accurate output. You have to add 4 power in power function if you want to find 4 digit armstrong number.

  • @greeneyepirates7169
    @greeneyepirates7169 Před 3 lety +1

    // THIS WILL BE BETTER AND WILL COVER ALL EXTREME CASES LIKE 1 , O , - VALUES ETC
    #include
    using namespace std;
    int main()
    {
    int n;
    cin>>n;
    bool flags=0;
    if(n

  • @surojitmodak2069
    @surojitmodak2069 Před 3 lety +5

    Not valid for no. ending with zero

  • @CodersHubYoutube
    @CodersHubYoutube Před 3 lety +8

    Loved this Series ❤️
    but there is an error in the last armstrong question pow(lastdigit,3) is not working instead we can use lastdigit*lastdigit*lastdigit then the program works well

  • @shardulkhadye5875
    @shardulkhadye5875 Před 3 lety +1

    better approach for reversing a number is taking the input in string format and then running a loop for string size times starting from size-1 index and outputting the element at the i th position - '0'

    • @harshshelar
      @harshshelar Před 3 lety

      That will be reversing a string not number

    • @shardulkhadye5875
      @shardulkhadye5875 Před 3 lety

      @@harshshelar if u declare string s , input s then even the number will be input as string and my method will give correct output

    • @harshshelar
      @harshshelar Před 3 lety

      @@shardulkhadye5875 Your method will give correct output, but the data type is different. It's one thing to reverse a number and another to reverse a string. You can't traverse an integer

  • @ramankr0022
    @ramankr0022 Před 2 lety

    very helpful video.. thank u for the course