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

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

КОМЕНТАРІ • 1,1 тис.

  • @prathamvyas8342
    @prathamvyas8342 3 роки тому +354

    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.

  • @Soumalyasarkar1
    @Soumalyasarkar1 2 роки тому +16

    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 💝

  • @anshdholakia714
    @anshdholakia714 4 роки тому +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

    • @lazzyBoiii
      @lazzyBoiii 6 місяців тому

      That was more than just a prime number.

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

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

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

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

  • @appexplored7678
    @appexplored7678 4 роки тому +113

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

    • @balbhadra_
      @balbhadra_ 4 роки тому +16

      Chl be itna v mt bnao bhkt

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

      No

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

      @Tushar Sachdeva anuj bhaiya m accha pdhyaya tha last year java and python for class 12 is baar ni maaza aa rha utna animation se kch ni hota

    • @raj.photoclicker
      @raj.photoclicker 4 роки тому

      @@balbhadra_😂😂👍

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

      @Tushar Sachdeva true

  • @monikajain6237
    @monikajain6237 4 роки тому +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 4 роки тому +8

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

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

      @@Arceus948 I am saying to Aman dhattarwal bhaiya

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

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

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

      @@rudranarayandash9981 thanks

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

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

  • @therak4392
    @therak4392 4 роки тому +83

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

  • @QuransGems-zd1jd
    @QuransGems-zd1jd 5 місяців тому

    I like how every second question has something new and also has something from the previous question, helps in memory retention!

  • @PANKAJKUMAR-fe8zn
    @PANKAJKUMAR-fe8zn 4 роки тому +31

    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.

  • @biyyalaharikrishna381
    @biyyalaharikrishna381 4 роки тому +39

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

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

      yes bro agree with you i too was thinking about it

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

      Yeahhh... Agree 👍

  • @kartikeyadubey1266
    @kartikeyadubey1266 4 роки тому +24

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

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

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

  • @kushalappaca5324
    @kushalappaca5324 3 роки тому +16

    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 3 роки тому +3

      yahi dekhne comment m aaya tha.

    • @Sby-03
      @Sby-03 2 роки тому +1

      Absolutely u are right....

    • @serenityxalt
      @serenityxalt Рік тому +2

      //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.

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

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

  • @UnKnown-id7ih
    @UnKnown-id7ih 4 роки тому +6

    Your way of teaching is mind blowing thanku didi❤

  • @QuransGems-zd1jd
    @QuransGems-zd1jd 5 місяців тому

    I repeat along with you everytime I hear you say "right!"

  • @RiteshNEVERUNIFORM
    @RiteshNEVERUNIFORM 3 роки тому +26

    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 2 роки тому

      ua-cam.com/video/aU2WT2OUeww/v-deo.html

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

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

  • @sayanghosh6996
    @sayanghosh6996 4 роки тому +69

    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 4 роки тому +3

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

    • @manishkumarparmar412
      @manishkumarparmar412 4 роки тому +10

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

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

      Yup thts a prblm

    • @shreyashraj
      @shreyashraj 4 роки тому +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 4 роки тому +1

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

  • @AritraRoyRup
    @AritraRoyRup 4 роки тому +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.

  • @satyampathak9133
    @satyampathak9133 4 роки тому +9

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

  • @shubhangtiwari4315
    @shubhangtiwari4315 3 роки тому +8

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

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

      we have to store that reverse not just to print

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

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

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

    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 4 роки тому

      this has been given in a previous video bro

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

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

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

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

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

      @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 4 роки тому

      @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).

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

    aise first tutor hai jisko speed kam krke sunna padta

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

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

  • @JaySir_4U
    @JaySir_4U Рік тому +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🙏🙏

  • @samarthsakhare7058
    @samarthsakhare7058 3 роки тому +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

  • @VibhaGupta-f9k
    @VibhaGupta-f9k Рік тому +1

    int n;
    cin>>n;
    while(n>0){
    cout

  • @lekhshisodiya6094
    @lekhshisodiya6094 2 роки тому +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

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

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

  • @ayushabrol1406
    @ayushabrol1406 3 роки тому +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);
    }

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

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

  • @Study-cf5dx
    @Study-cf5dx Рік тому +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 .

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

    Wahiyat ek dum!!!!! Optimization kaun sekhayega hume........

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

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

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

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

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

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

  • @sagartamrakar1919
    @sagartamrakar1919 3 роки тому +3

    The way you teach is awesome.

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

    Didi Bhout Gajab padhate ho

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

    Reverse was explained so brilliantly

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

    For reversing a no. I have a better approach :
    #include
    #include
    using namespace std;
    int main( ) {
    int n;
    cin>>n;
    string r = to_string(n) ;
    for(int i= r. length( ); i>=0;i--) {
    cout

    • @Dhirendrakumar-fe3nn
      @Dhirendrakumar-fe3nn 2 роки тому

      stl liberary

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

      we are asking intiger not string

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

      @@overskilled1393 does it matter? NO

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

      @@heirofsam bro string me answer ana or intiger me answer ana me bhot fark hai 😂 , I just pointed it so he can rethink about this que, don't take it as wrong

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

      @@overskilled1393 I was researching the same till now 🤡 turns out you were right!! Sorry :)

  • @rajeshjha6801
    @rajeshjha6801 4 роки тому +8

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

  • @RahulRajput-yn5tz
    @RahulRajput-yn5tz 3 роки тому +1

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

  • @namangadia9056
    @namangadia9056 4 роки тому +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 4 роки тому

      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 4 роки тому

      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 4 роки тому

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

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

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

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

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

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

    Please, just a reminder didi... Ki ye channel boht log dekhte hain.. Isliye question ka amount aur toughness dono increase kariye, please 🙏 BTW thank u for awesome explanation, hope so ki aap aage data structure ache se cover kare

  • @anvithaki8935
    @anvithaki8935 4 роки тому +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 4 роки тому +1

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

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

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

    • @anvithaki8935
      @anvithaki8935 3 роки тому +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 3 роки тому

      ua-cam.com/video/5FsIa4Mp3ho/v-deo.html

  • @shardulkhadye5875
    @shardulkhadye5875 4 роки тому +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 3 роки тому

      That will be reversing a string not number

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

      @@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 3 роки тому

      @@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

  • @pretty4436
    @pretty4436 4 роки тому +37

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

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

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

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

      @@anonymous7860 bro 🤜 I'm not a fool

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

      @@pretty4436 are you from general category?

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

      I am waiting for this

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

      #easycomputerprogramming

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

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

  • @kedardeshmukh7173
    @kedardeshmukh7173 4 роки тому +8

    Hello Sir Please make a course on Graphic design

  • @Yashwanth89
    @Yashwanth89 3 місяці тому

    Amstrong is not only for cubes, it's the power of number of digits

  • @kashifamir4795
    @kashifamir4795 3 роки тому +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

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

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

  • @Harshp062
    @Harshp062 4 роки тому +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 में। 👌👌👌

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

    Correction in armstrong number 7:51 .....Armstrong no. is equal to the sum of its own digits raised to the power of the number of digits (and not always the cube)

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

      can u also tell what can i do to find length of no so that i could use that to put it as power . i hv used len () but not working

  • @PiyushKumar-zy3zu
    @PiyushKumar-zy3zu 4 роки тому +28

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

    • @ApnaCollegeOfficial
      @ApnaCollegeOfficial  4 роки тому +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 4 роки тому +2

      @@ApnaCollegeOfficial ok bhaiya❤❤❤

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

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

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

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

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

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

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

    didi ne to dil tod diya : )

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

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

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

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

  • @vivekshenoy6335
    @vivekshenoy6335 4 роки тому +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!

  • @lalithnarayanan1979
    @lalithnarayanan1979 3 роки тому +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 2 роки тому +1

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

  • @akay5797
    @akay5797 4 роки тому +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 ❤❤❤

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

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

  • @thunderbolt9624
    @thunderbolt9624 3 роки тому +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 3 роки тому

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

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

      //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.

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

    SB PHOD DO!! 🔥🔥
    All the best 👍

  • @shahhet8354
    @shahhet8354 4 роки тому +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

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

    we can also do i*i

  • @Abhishek-ks6ns
    @Abhishek-ks6ns 4 роки тому +3

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

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

    very helpful video 😎😎

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

    First comment and first attendance 😁

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

      Tauba tauba saara mood kharab Kar Diya

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

      Marunga 10, ginunga 1

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

      @@veersharma1013 😂😂😂 video dekh aur kuch seekh ( he is my college friend 😁)

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

      @@shashikiran6092 🤣🤣🤣 (yet another college friend 😁)

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

      @@snehilsinha5624 likh leta hun kahin upsc mein na aa jaye

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

    Still can't believe, I acquired all this knowledge free of cost. 🤗🤗

  • @ragingshadow7420
    @ragingshadow7420 4 роки тому +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.

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

    #include
    #include
    using namespace std;
    int main()
    {
    int n;
    cout

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

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

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

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

    • @adtech6706
      @adtech6706 4 роки тому +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.

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

    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.

  • @parbhatkataria9110
    @parbhatkataria9110 4 роки тому +15

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

    • @Aman-jl7kp
      @Aman-jl7kp 4 роки тому

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

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

      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);
      }

  • @sambhavsharma2780
    @sambhavsharma2780 2 роки тому +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.

  • @cyanider069
    @cyanider069 3 роки тому +17

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

  • @prajjawalkushwaha4352
    @prajjawalkushwaha4352 4 роки тому +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.

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

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

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

    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.

  • @CodersHubYoutube
    @CodersHubYoutube 3 роки тому +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

    • @adityaadep8703
      @adityaadep8703 3 роки тому +3

      yes correct i was checking if someone commented this

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

      Tnkq coder hub

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

      Aagar aap int sum ki jaga double sum code kroge then it's work fine

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

      @@sohebshaikh3344 welcome buddy 😉

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

      @@sohebshaikh3344 right, that works too 😁

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

    // An alternative approach to reversing number
    #include
    #include
    using namespace std;
    int main()
    {
    long long int num;
    printf("Enter Number : ");
    scanf("%lld", &num);
    string x = to_string(num);
    reverse(x.begin(),x.end());
    long long int mun = stoll(x);
    if (num < 0) {mun = 0 - mun;} // Preserving input sign in Output
    printf("Output Number : %lld
    ", mun);
    return 0;
    }

  • @henrysingh3861
    @henrysingh3861 3 роки тому +7

    Please note that if you initialize the sum and the last digit, let it be in float format. Else for example sum is coming out to be 152 and the number is 153.
    It is related to the pow returning float

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

    another method for checking if a number is prime or not :-
    #include
    using namespace std;

    int main (){
    int n,i,count=0;

    cin>>n;
    for(i=2;i

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

      we can also do this by
      #include
      using namespace std;
      int main(){
      int a;
      cout a;
      if(a%2==0){
      cout

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

      @@hello_lakshya7456 here if you take a = 2 then it will print prime but 2 is not a prime number

  • @farhatali307
    @farhatali307 3 роки тому +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 3 роки тому +3

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

    • @Pokemonzone2323
      @Pokemonzone2323 3 роки тому +28

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

    • @thewhitene9746
      @thewhitene9746 2 роки тому +5

      Yaar ye interpreter ke alag hi nakhre hote he 😭

    • @HimanshuSharma-oo9fc
      @HimanshuSharma-oo9fc 2 роки тому +2

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

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

      Yes same for me also

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

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

  • @ganeshbansode9380
    @ganeshbansode9380 3 роки тому +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 2 роки тому

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

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

      @@sathvikreddy4807 Happy to hear you...

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

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

  • @09avishkargaikwad71
    @09avishkargaikwad71 2 роки тому

    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

  • @nikunjgarg3754
    @nikunjgarg3754 4 роки тому +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?

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

    while (n>0) {
    cout

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

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

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

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

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

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

  • @ravenmehta2080
    @ravenmehta2080 4 роки тому +15

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

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

    Thank You For All These Tutorials.

  • @groots17
    @groots17 3 роки тому +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

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

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

  • @dipanpal2743
    @dipanpal2743 3 роки тому +3

    Thanks a lot Mam ♥️...but I face a problem in Armstrong Number program... when I using pow() function, only in case of 153, the total sum give 152 and other three digits number are giving correct...and when using powf() function it run correctly in all cases.

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

      Are bro pow() float memory leta he isliye
      Just use lastddigit* last.....3 times hojayega

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

      @@priyanshugagiya ha vai waisei kiya...magar Mam ka woh wala kaise run ho gya 😕

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

      ua-cam.com/video/5FsIa4Mp3ho/v-deo.html

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

    Thankyou for such great content and so easy and informative.