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.
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 💝
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
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
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.
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.
//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.
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
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.
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.
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
@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).
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
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
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 .
www.change.org/p/prime-minister-narendra-modi-remove-the-caste-based-reservation-system-2?recruiter=1157950432& सारे सवर्ण भाई, कृपया इस पेटिशन को शाइन करे और आरक्षण के खिलाफ अपनी आवाज़ बुलंद करे। जय सवर्ण एकता। जय चित्रगुप्त भगवान..।।
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
@@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
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.
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
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)
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
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 🔥
@@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.
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'
@@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
www.change.org/p/prime-minister-narendra-modi-remove-the-caste-based-reservation-system-2?recruiter=1157950432& सारे सवर्ण भाई, कृपया इस पेटिशन को शाइन करे और आरक्षण के खिलाफ अपनी आवाज़ बुलंद करे। जय सवर्ण एकता। जय चित्रगुप्त भगवान..
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
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 में। 👌👌👌
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)
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
@@ApnaCollegeOfficial physics courses on this channel? I thought you'd continue marathon for mechanics...(rotation and SHM) will there be more marathons?
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!
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
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 ❤❤❤
//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.
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
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.
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); }
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.
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.
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.
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
// 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; }
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
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 .
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
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?
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.
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.
ha
ufff u saved me some time abhi dimaag ka bhosda ho gaya tha
thank you it helped me
@@meghdootpanda9733 😂😂
You can also use
Sum+=lastdigit*lastdigit*lastdigit
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 💝
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
That was more than just a prime number.
Reversing a num :
Int main() {
Int num, quo ;
cin>>num;
While(num>0){
cout
with this code if you have input 154000, it'll print 000451
Aman Dhattarwal is going to get THE BHARAT RATNA for this revolution.
❤️
Chl be itna v mt bnao bhkt
No
@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
@@balbhadra_😂😂👍
@Tushar Sachdeva true
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
She is sister 😅😅😂😂. And she is our teacher so pls say Mam 😤😤
@@Arceus948 I am saying to Aman dhattarwal bhaiya
@@monikajain6237 People with a normal mind got what you meant. I share your feeling.
@@rudranarayandash9981 thanks
@@monikajain6237 i am your brother sister don't fell lonely i also don't have real sister i know the feeling
I just love the beats at the beginning and at the ending of the video ....!!!
same here
Yay and learn nothing in between just colorfull display
I like how every second question has something new and also has something from the previous question, helps in memory retention!
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.
Nice explantion mam. but small correction Armstrong number is sum of each digit raised to power of no of digits. (not 3).
yes bro agree with you i too was thinking about it
Yeahhh... Agree 👍
It is like a blessing for me that I got to know about this C++ course. Really a very nice method and content.
Aman bhaiya jo bolte hai woh karke dikate hai blessed to have u bhaiya❤
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.
yahi dekhne comment m aaya tha.
Absolutely u are right....
//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.
i found this randomly, and this is like a jackpot ; D
Your way of teaching is mind blowing thanku didi❤
I repeat along with you everytime I hear you say "right!"
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
ua-cam.com/video/aU2WT2OUeww/v-deo.html
Hey is the prime number problem running if I take input as 4 I am not understanding the way how it will work?
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.
Yeah that's what I was thinking too..😅
Sab tareef hi kar rahe hai, particular video k bare me koi nahi bol raha
Yup thts a prblm
Actually there are two definitions of armstrong no. If you google you will find out thatt def. is correct in the video.
What you are talking about are Narcissistic numbers...not Armstrong Numbers
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.
Yes it returns value of 5^3 as 24.9999
@@darshankhairnar3511 I think u mean 124.9999
use round(pow(a,b)) to round it
This kind of common problems should be pinned.
yaa thnks;
Grt work bro❤️❤️❤️❤️❤️
U r inspiration of thousands of people 🔥🔥🔥🔥
It can also be done as follows :
while(n>0){
int lastdigit = n%10;
cout
we have to store that reverse not just to print
This is what the student wants....Perfect education and education system
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
this has been given in a previous video bro
@Yath YT please put that if(i==root n +1) inside the for loop. I think it should work after that.
@Yath YT #include
#include
using namespace std;
int main()
{
int n,i;
cout
@Yath YT I have used ur code and made some minor changes. this works.
Just use an else statement in the end :D
@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).
aise first tutor hai jisko speed kam krke sunna padta
Thank You very much, mam and aman bhaiya
i understand everything from 1st video.
mam I am 15 year old and I giving you a like because I learn about "pow" In this video thank you so much🙏🙏
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
int n;
cin>>n;
while(n>0){
cout
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
DIDI was the point which forced me to read comments :)
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);
}
yeah it works!!
thanks buddy
I used double in place of int for sum and it worked as well.
#include
using namespace std;
int main()
{
Everyone - theek hai
Apni didi - tchick aee (7:33)
return 0;
}
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 .
Wahiyat ek dum!!!!! Optimization kaun sekhayega hume........
Wow today teaching style was very much similar to Aman bhaia teaches physics🔥 .
👍👍👇👇👇
www.change.org/p/prime-minister-narendra-modi-remove-the-caste-based-reservation-system-2?recruiter=1157950432&
सारे सवर्ण भाई, कृपया इस पेटिशन को शाइन करे और आरक्षण के खिलाफ अपनी आवाज़ बुलंद करे।
जय सवर्ण एकता।
जय चित्रगुप्त भगवान..।।
Them:-What are you doing?
Me:-looking at a Masterpiece!
This course is legit amazing!!!
The way you teach is awesome.
Didi Bhout Gajab padhate ho
Reverse was explained so brilliantly
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
stl liberary
we are asking intiger not string
@@overskilled1393 does it matter? NO
@@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
@@overskilled1393 I was researching the same till now 🤡 turns out you were right!! Sorry :)
Bhaiyya please upload a doubt session...
As a learner I have some doubts in few questions
correct program for prime numbers.
#include
#include
using namespace std;
int main(){
int n;
coutn;
bool flag=0;
for(int i=2;i
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.
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
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)
Yes you told correct
Ans sir please try to improve this problem
I LOVED THE REVERSE NUMBER PROGRAM SO COOOLLLL!!!!!!!!!
this is my first time that I teaching with 'DIDI'
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
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 🔥
how would have this course changed u if you had this in 1st yearbro,im ini 2nd year ,
please reply ash prospect's question .... you have welgth of experince , don't ruin it !
@@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.
ua-cam.com/video/5FsIa4Mp3ho/v-deo.html
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'
That will be reversing a string not number
@@harshshelar if u declare string s , input s then even the number will be input as string and my method will give correct output
@@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
*Please🙏 introduce with your 7 Member Pro team 😀*
www.change.org/p/prime-minister-narendra-modi-remove-the-caste-based-reservation-system-2?recruiter=1157950432&
सारे सवर्ण भाई, कृपया इस पेटिशन को शाइन करे और आरक्षण के खिलाफ अपनी आवाज़ बुलंद करे।
जय सवर्ण एकता।
जय चित्रगुप्त भगवान..
@@anonymous7860 bro 🤜 I'm not a fool
@@pretty4436 are you from general category?
I am waiting for this
#easycomputerprogramming
The way of teaching is amazing..
Great work di..😊
Hello Sir Please make a course on Graphic design
Amstrong is not only for cubes, it's the power of number of digits
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
You are wrong as it's not less than, it's less than and equal to.
You are correct.
very nice teaching mam...... Awesome👌👌🔥🔥
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 में। 👌👌👌
thoda or maska lga
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)
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
Plz upload class 12 lectures specially of physics ....
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
@@ApnaCollegeOfficial ok bhaiya❤❤❤
@@ApnaCollegeOfficial ok thnx bhaiya❤️❤️❤️
@@ApnaCollegeOfficial physics courses on this channel? I thought you'd continue marathon for mechanics...(rotation and SHM) will there be more marathons?
@@aaryanale9538 wait first let Aman Bhaiya complete class 12 syllabus for BOARD EXAMS
didi ne to dil tod diya : )
sir, at the end of the video brain teaser daldete toh aur maja aata aur quiz related to that topic....thanks alot
Didi(appi)
Thanks for clarifying my confusion about prime numbers
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!
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
hey bro, can explain why you use int power=log10(n)+1; and round(pow(lastdigit,power));??
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 ❤❤❤
Bhai aap bohot acchaa kaam kr re ho , god bless u.😁
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^
U are right we have to find number of digits also 👍
//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.
SB PHOD DO!! 🔥🔥
All the best 👍
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
we can also do i*i
Oh maa tai!
@Apna college , didi apka name Urvi Goel hena , Kay mene sahi decode he 😁😁 apse coding and decoding dono sikhane ko mil rahi he ❤️
very helpful video 😎😎
First comment and first attendance 😁
Tauba tauba saara mood kharab Kar Diya
Marunga 10, ginunga 1
@@veersharma1013 😂😂😂 video dekh aur kuch seekh ( he is my college friend 😁)
@@shashikiran6092 🤣🤣🤣 (yet another college friend 😁)
@@snehilsinha5624 likh leta hun kahin upsc mein na aa jaye
Still can't believe, I acquired all this knowledge free of cost. 🤗🤗
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.
Same here bro
Use round(pow(a,b));because pow returns decimals
Same
#include
#include
using namespace std;
int main()
{
int n;
cout
What is bool flag ? And how it's work?
Please Didi explain the concept when new parameters is in use
It's a function that returns only two either two of value, that is true or false.
'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.
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.
di, please explain pascal's triangle in your next video🙏🙏🙏🙏
Establish a relation between nCr and nC(r-1) and you will get it done
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);
}
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.
If 153 shows "Not an Armstrong Number" try round(pow(lastdigit, 3))
Thanks,but till now I already wasted my 30 min😂
It is an Armstrong no
Is this code false????
Holy sheit! It worked. Thanks a lot.
Thank you so much bhaiiii
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.
Thanks, for clearing the misconception.
@@starkendeavours7072 I’ve seen you on unacademy jee
@@LegitGamer2345 Yup.
Bhaiya kya ye c++ course begginers dekh sakte hai?
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.
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
yes correct i was checking if someone commented this
Tnkq coder hub
Aagar aap int sum ki jaga double sum code kroge then it's work fine
@@sohebshaikh3344 welcome buddy 😉
@@sohebshaikh3344 right, that works too 😁
// 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;
}
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
Thanks
bahut shi bataye guru, varna non armstrong bata rha tha
Thanks bro, But why this happens
ua-cam.com/video/5FsIa4Mp3ho/v-deo.html
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
we can also do this by
#include
using namespace std;
int main(){
int a;
cout a;
if(a%2==0){
cout
@@hello_lakshya7456 here if you take a = 2 then it will print prime but 2 is not a prime number
didi i wrote the same ditto code for amstrong number on visual studio but its not working plz help what would have gone wrong
same...the same code of the notes is showing opposite result in vs code
Try using ..sum= sum+(lastdigit*lastdigit*lastdigit) in place of.. sum+=pow(lastdigit, 3)..
Hope it will solve ur prblm..
Yaar ye interpreter ke alag hi nakhre hote he 😭
Mera to bhai prime number wla code bhi different output de raha hai
Yes same for me also
Love your teaching sister 🙏and thanks Bhaiya for making Video's 🎉.
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 .
god, thanks to you, i have been having the same difficulty and scratching my head from morning
@@sathvikreddy4807 Happy to hear you...
@@ganeshbansode9380 if i may ask, did you complete the whole playlist?
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
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?
me also
Bet u r working on windows
Yub
Yaa me too
yes me too
while (n>0) {
cout
🥺😭bhaiya thode paap bhi krlo nhi to bhagwan ban jaoge 😭😭♥️♥️♥️♥️
Abey chup😵😵
Use round(pow(lastdigit, 3)); if power function is giving wrong output.
Thanks for this, my program worked fine but with 153 it showed that it's not Armstrong, after using round () it worked.
Reverse number in python lol:
print(int(input()[::-1]))
You will not understand any inner logic using this.
Thank You For All These Tutorials.
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
use original in while
Aman bhaiya u r my inspiration
Lots of love bhaiya♥️
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.
Are bro pow() float memory leta he isliye
Just use lastddigit* last.....3 times hojayega
@@priyanshugagiya ha vai waisei kiya...magar Mam ka woh wala kaise run ho gya 😕
ua-cam.com/video/5FsIa4Mp3ho/v-deo.html
Thankyou for such great content and so easy and informative.