Python Program to Find Sum of First n Natural Numbers - In Hindi

  Рет қаралды 158,431

codeitup

codeitup

Күн бұрын

Python Program to Find Sum of First n Natural Numbers - In Hindi - Tutorial#16
In this video, I have explained a program with while loop to to find sum of first n natural numbers in python. This is a basic program to to find sum of first n natural numbers using while loop. While loop is the basic looping system in Python Programming. Natural Numbers start with 1 and it goes upto N. We have to find sum all the numbers from 1 to a N (given by the user).
Looping/While statement is used to execute a single statement or a block of statement n times till the condition is true. Every loop must contain three parts:
1. Initialization of counter variable.
2. Condition
3. Increment/Decrement of counter variable
While loop or any loop will work fine if all the three parts are there in the programs. If any one is missing the loop will not run properly.
Link to Previous Video: • Print First N Natural ...
Link to Next Video: • Python Program to Find...
Facebook Group: www.facebook.c...
Facebook Page: / codeitup-104310264625489
Website: codeitup.in
Tags Used:
Find Sum of First n Natural Numbers
python,python tutorial in hindi
python tutorial for beginners
complete python tutorial in hindi
while loop in python
while loop in python in hindi
while loop in python programming
loops in python programming
loops in python for beginners
programming exercises python
python while loop examples
while program in python
while programming in python
find sum of first n natural numbers in python
sun of first n natural numbers
#codeitup
#whileloop
#python

Пікірлер: 185
@ritambhardwaj9405
@ritambhardwaj9405 4 жыл бұрын
bro you posted this video about a year ago and this turned beneficial for me today! i was so much confused and got agitated by these loops concepts but here when i watched this video it immediately made me learn looping very easy. your way of explaining is really good. 👍 i must say you teach better than my python tuitor. i hope you will never stop making such easy to learn videos, keep on my making & i have to say this that your all python videos come very much in handy for me & many others like me as well. a big thanks & gratitude to you😇😊 all the best for your YT channel keep it growing ☺
@ritambhardwaj9405
@ritambhardwaj9405 4 жыл бұрын
here adding one more comment to this 'cause i forgot to mention this point in my previous comment & thought its worth mentioning as well, i watched videos of famous YT channels who got 23k to 2m views but only yours video made me clear my concepts of looping 😊
@codeitup
@codeitup 4 жыл бұрын
@@ritambhardwaj9405 It gives me inner peace when I get such comments that my videos are helping many students like you. God Bless You. Keep Learning!
@abhijeetsonker3492
@abhijeetsonker3492 2 жыл бұрын
yess bro.....he is literally one of the best tutor for programing on YT.
@ANAMIKA7508
@ANAMIKA7508 4 жыл бұрын
Baaki saari videos python ki wrong h, only u r right...
@codeitup
@codeitup 4 жыл бұрын
:)
@janhvisurendrayadav9741
@janhvisurendrayadav9741 4 жыл бұрын
Itna bda Amul butter sir k liye😂😂kidding
@codeitup
@codeitup 4 жыл бұрын
☺️
@karanrajbharti7590
@karanrajbharti7590 2 жыл бұрын
@@codeitup bhaiya iska code krne pr output kuch is parkar aa raha hai Enter no:6 Sum=1 Sum=3 Sum=6 Sum=10 Sum=15 Sum=21
@karanrajbharti7590
@karanrajbharti7590 2 жыл бұрын
Humko direct is type se ana chahiye n Hm no Dale 5 15 direct ana chahiye
@arunagoswami3788
@arunagoswami3788 4 жыл бұрын
This is the first video which I watched on ur channel and subscribed ur channel and liked. Sir ur explanation is really very easy and nice. Please make and more videos. I will keep on liking and watching them. Thank you sir.
@codeitup
@codeitup 4 жыл бұрын
Thanks Aruna. Please share this channel with your friends as well.
@HarivallabhPanchi
@HarivallabhPanchi 4 жыл бұрын
Your python knowledge and teaching should be shared...... BEST TUTOR FOR PYTHON
@codeitup
@codeitup 4 жыл бұрын
Many many thanks !
@ShaikhMahujabeen
@ShaikhMahujabeen Жыл бұрын
Sir it had not only made this topic easier but also made an interest in learning python . Thankyou sir it mean a lot for me.
@codeitup
@codeitup Жыл бұрын
Most welcome dear & thanks a lot for your precious comment😊
@abhijeetsonker3492
@abhijeetsonker3492 2 жыл бұрын
litrally bhaiya aapne bhut zada acha explain kiya......poora concept clear ho gya ache se
@codeitup
@codeitup 2 жыл бұрын
Thanks Abhijeet... Keep learning😊
@radhikabinesh4363
@radhikabinesh4363 3 жыл бұрын
Thankyou sir very very much ....i cannot believe someone teaching with so much patience..you explained each and every line very nicely thank you🤗
@codeitup
@codeitup 3 жыл бұрын
Glad to help you😊
@devilraj007
@devilraj007 2 жыл бұрын
BROTHER I SEE lots of video on this type but your teaching skill is on another level
@codeitup
@codeitup 2 жыл бұрын
Thanks dear😊
@devilraj007
@devilraj007 2 жыл бұрын
@@codeitup you describe every thing,each code, every logic Then teach how to code it's very helpful for us thanx bro
@amazonshoppingstore8888
@amazonshoppingstore8888 Жыл бұрын
I am in love with you only within 5 sec , becoz I realised without even seen the video that finally I found the channel that easily take me out from the python problems .
@codeitup
@codeitup Жыл бұрын
😊👍
@prayasnayak7136
@prayasnayak7136 3 жыл бұрын
Excuse me sir !! 😅 It's alternative Other than using loop 😅😅 Syntax: n=int(input("enter the no upto which you want to add :")) a=n+1 b=n*a c=b/2 print ("your reasult ",c) Thank you sir !! #codeitup
@RohanSharma-ni1vp
@RohanSharma-ni1vp 2 жыл бұрын
gajab topibaz ho bhai🤣
@prayasnayak7136
@prayasnayak7136 2 жыл бұрын
@@RohanSharma-ni1vp 😁😁
@ayushsahu8002
@ayushsahu8002 2 жыл бұрын
this is the formula of Sn = n(n+1)/2.. LOL!!!
@k415hu7
@k415hu7 3 жыл бұрын
You teach better then the teachers of our school
@codeitup
@codeitup 3 жыл бұрын
😊
@aarohansharma4551
@aarohansharma4551 4 жыл бұрын
Thanks for explaining this lucidly!! Really helpful
@codeitup
@codeitup 4 жыл бұрын
Thanks Aarohan. Keep Supporting.
@amish9324
@amish9324 3 жыл бұрын
Nic explaination🙏 My brain was so confused but,your explaination remove my confusion Thankyou so much 💐
@latajoshi6284
@latajoshi6284 2 жыл бұрын
Sir, i like ur vedioes very much, u explain very well, and in easy way.
@codeitup
@codeitup 2 жыл бұрын
Thanks a lot Lata.. Keep learning😊
@KpYadav-ys3uy
@KpYadav-ys3uy 9 ай бұрын
Sir apka best videos ❤ Gzb explain
@codeitup
@codeitup 9 ай бұрын
Thanks 🙏
@Alok84able
@Alok84able 5 жыл бұрын
Good One
@codeitup
@codeitup 5 жыл бұрын
Thanks
@leon.s.kennedy5198
@leon.s.kennedy5198 2 жыл бұрын
Sir I wish you would my teacher in my school.but bad luck.the way you teach is really very nice 🙂🙂
@codeitup
@codeitup 2 жыл бұрын
Thanks dear!
@harshitkanojiya9752
@harshitkanojiya9752 3 жыл бұрын
Sir ager har teacher AAP ke jaisa ho to python kitne aasan ho jai😢😢
@codeitup
@codeitup 3 жыл бұрын
😀😀
@Ak-if2fp
@Ak-if2fp 3 жыл бұрын
Thank you so much sir, you helped me a lot..✌️✌️✌️
@codeitup
@codeitup 3 жыл бұрын
Glad to help you dear😊
@sidj99
@sidj99 3 жыл бұрын
hats off to perfect clean explanation. tx a lot sir.
@codeitup
@codeitup 3 жыл бұрын
Thanks & most welcome Siddharth!
@abhimangaur
@abhimangaur 3 жыл бұрын
Your teaching style is very good Thank you very much sir ji
@codeitup
@codeitup 3 жыл бұрын
My pleasure Abhiman, God bless you 😊
@abhimangaur
@abhimangaur 3 жыл бұрын
@@codeitup thank you very much sir ji
@tejasvipratap9906
@tejasvipratap9906 3 жыл бұрын
nice explained, You made this easy to understand. ...all is video too good, thank you bro
@codeitup
@codeitup 3 жыл бұрын
Thanks & most welcome Tejasvi!
@arkyaacharya2063
@arkyaacharya2063 4 жыл бұрын
Sir I have a question "Why we need to take the 'sum' variable in this program?
@codeitup
@codeitup 4 жыл бұрын
In this program, we have to find sum from 1 to n. So we need a variable in which we will store the final sum and that's why we have take sum variable. However, the variable name can be anything.
@punitkundalia7872
@punitkundalia7872 4 жыл бұрын
Thanks sir 👍
@codeitup
@codeitup 4 жыл бұрын
Thanks Punit. Keep Supporting.
@samudrabaishya8286
@samudrabaishya8286 4 жыл бұрын
Thnq sir
@codeitup
@codeitup 4 жыл бұрын
Support this channel to grow Samudra...
@chhitizsrivastava2842
@chhitizsrivastava2842 4 жыл бұрын
I sugget you put print function before increment operator. It helps you to print (i, "Sum = ", sum ) in proper way.
@codeitup
@codeitup 4 жыл бұрын
Ok Chhitiz, thanks for the concern. However, there are n number of ways to make a single program. Keep Learning !
@Velog113
@Velog113 3 жыл бұрын
Sir meri ek request he k sir ap ek mazeed video bnaye jis me is python k related task ho q k hmara dimagh kam nhin krta k hum kiya task kre so sir please 1 more video... Shayed ap k pas time na ho lekin sir plz
@ramyak5149
@ramyak5149 4 жыл бұрын
thanks a lot . loops confuse me so much :( and i have my viva coming so thanks
@codeitup
@codeitup 4 жыл бұрын
Welcome Ramya, I think now you got the concept of loops well.
@abhi7155
@abhi7155 Жыл бұрын
Thank you so much sir...This vedio is helpful ❤✨
@suchetabhatia4473
@suchetabhatia4473 Жыл бұрын
Thanks a lot bhai aapko
@codeitup
@codeitup Жыл бұрын
Always welcome🙂
@suchetabhatia4473
@suchetabhatia4473 Жыл бұрын
@@codeitup please mujhe hpsc pgt k liy python k liy guide kr do please. 🙏🙏
@Factknowledge505
@Factknowledge505 Жыл бұрын
Very nice lecture sir.
@_.Amisha._.Patel._
@_.Amisha._.Patel._ 3 жыл бұрын
GURU JI thankyou soo much 😍😍
@sudip2616
@sudip2616 3 жыл бұрын
it was very useful
@codeitup
@codeitup 3 жыл бұрын
Thanks 😊
@sannijoshi9468
@sannijoshi9468 9 ай бұрын
Good all video
@codeitup
@codeitup 9 ай бұрын
Thanks !
@ggauravsinghal9516
@ggauravsinghal9516 2 жыл бұрын
hello sir, why can't we write sum=sum+i after i=i+1
@umamansari4040
@umamansari4040 2 жыл бұрын
Zbrdst 👍🏻👍🏻👍🏻👍🏻
@codeitup
@codeitup 2 жыл бұрын
Thanks😊
@Shivani_Dwivedi63
@Shivani_Dwivedi63 Жыл бұрын
Thankyou sir 😊
@allYouTubeShorts.1441
@allYouTubeShorts.1441 Жыл бұрын
Thanks alot sir.
@codeitup
@codeitup Жыл бұрын
Most welcome!
@Gauravishere7
@Gauravishere7 3 жыл бұрын
sir you are the anand sir of super 13.7 k
@codeitup
@codeitup 3 жыл бұрын
Some comment gives me immense pleasure, and this is the same... Thanks dear!
@vishalpathak1989
@vishalpathak1989 3 жыл бұрын
sir please make videos on class 11 IP SQL PLEASE.............🙏🙏🙏🙏🙏
@codeitup
@codeitup 3 жыл бұрын
kzfaq.info/sun/PLmRclvVt5DtlM3Ef8ERo4sVVk-yTvSzX5
@vishalpathak1989
@vishalpathak1989 3 жыл бұрын
tqsm sir🙏🙏🙏
@archana5976
@archana5976 4 жыл бұрын
Nice video sir
@codeitup
@codeitup 4 жыл бұрын
#codeitup Thanks Archana..
@ArunKumar-mf9zj
@ArunKumar-mf9zj 3 жыл бұрын
Thnx sir sir ye 11th ki playlist he ye puri he ya abhi video baki he kuch
@codeitup
@codeitup 3 жыл бұрын
I think it is complete. How ever if anything is lagging, pls let me know...
@merrutvalapandat8472
@merrutvalapandat8472 Жыл бұрын
Sir this program is not running what should I do for it as I have tired to try it again and again 😔😔😔😔
@Rr7404-k9d
@Rr7404-k9d 2 жыл бұрын
Thank you sir
@codeitup
@codeitup 2 жыл бұрын
Most welcome!
@rishukumar2079
@rishukumar2079 2 жыл бұрын
Thank you sir for this solation
@codeitup
@codeitup 2 жыл бұрын
Most welcome Rishu!
@techabit
@techabit 2 жыл бұрын
Thanks a lot sir!!🙏
@codeitup
@codeitup 2 жыл бұрын
Most welcome dear😊
@letsknow9195
@letsknow9195 9 ай бұрын
THANK U SIR
@codeitup
@codeitup 8 ай бұрын
Welcome!
@shailusinha6129
@shailusinha6129 2 ай бұрын
Sir iss code mein .. 1+2+3 kaise show krwae ki like 3 diye input mein toh 1+2+3 or fir = 6 aay plzz sir bata dijiye
@rajivkumarmishra1525
@rajivkumarmishra1525 2 жыл бұрын
Tq very much
@codeitup
@codeitup 2 жыл бұрын
Most welcome Rajiv!
@lonewolfp8802
@lonewolfp8802 3 жыл бұрын
For Loop se possible hain ?
@codeitup
@codeitup 3 жыл бұрын
sum=0 n=int(input("Enter Number:")) for i in range(1,n+1): sum=sum+i print(sum)
@kavikaushik8388
@kavikaushik8388 4 жыл бұрын
You are able to obtain 200 k subscriber
@codeitup
@codeitup 4 жыл бұрын
Thanks Kaushik for your well wishes.
@xelios100
@xelios100 2 жыл бұрын
Sir, how the value of i becomes 2 as we took the variable as i=1. I have this confusion
@jashan0924
@jashan0924 3 жыл бұрын
GOOD TEACHER
@codeitup
@codeitup 3 жыл бұрын
Good Student !
@leonhardeuler7224
@leonhardeuler7224 4 жыл бұрын
Me (2 minutes into the video): Wait somethings wrong
@codeitup
@codeitup 4 жыл бұрын
Hmm I think you need tutorial in English.
@aarohansharma4551
@aarohansharma4551 4 жыл бұрын
@@codeitup lol
@HarivallabhPanchi
@HarivallabhPanchi 4 жыл бұрын
@@codeitup 😂😂
@kabe_boke21
@kabe_boke21 2 жыл бұрын
I wish you can do these videos in English so I can understand too Thanks
@jiyasharma5145
@jiyasharma5145 3 жыл бұрын
Sir I have a doubt....that if we write while(i>=n): instead of while(I
@codeitup
@codeitup 3 жыл бұрын
Every condition with loop must become false so that the loop could terminate. When you take a minus value, the loop never terminates.
@jiyasharma5145
@jiyasharma5145 3 жыл бұрын
@@codeitup okk sir..... thanks a lot
@pankajrathod2694
@pankajrathod2694 Жыл бұрын
Sir curser ko bracket ke bahar le jane ke liye short cut key bataiye
@sharu2619
@sharu2619 2 жыл бұрын
Sir please ap for loop ka bhi bata dena ya python me for loop use hi nahi hota
@meow-rd6op
@meow-rd6op 3 жыл бұрын
Nyc vide o 👌
@codeitup
@codeitup 3 жыл бұрын
Thanks🙂
@krishnakarmakar5912
@krishnakarmakar5912 2 жыл бұрын
thanks sir
@codeitup
@codeitup 2 жыл бұрын
Most welcome Krishna!
@san-rr6so
@san-rr6so 2 жыл бұрын
Sir can we use basic summation formula that is n*(n+1) /2????
@codeitup
@codeitup 2 жыл бұрын
No dear, you have to solve it using looping concepts.
@xeroday342
@xeroday342 3 жыл бұрын
Sir plz make one shot video on 11class python Because of appearing exams this month
@codeitup
@codeitup 3 жыл бұрын
OMG, that will be very lengthy !
@harshrajput799
@harshrajput799 Жыл бұрын
Thnx....
@codeitup
@codeitup Жыл бұрын
🙂
@debatradas1597
@debatradas1597 2 жыл бұрын
Thanks
@codeitup
@codeitup 2 жыл бұрын
😊
@medicaltechnologist5309
@medicaltechnologist5309 2 жыл бұрын
Sir please explain Multiplication of this program..
@funwithfafzu6226
@funwithfafzu6226 2 жыл бұрын
You have made it so difficult.
@srushtivankar1605
@srushtivankar1605 3 жыл бұрын
Can this code written without taking the sum variable??
@sohelmomin9051
@sohelmomin9051 Жыл бұрын
Mene ye 10 bar deka tbhi dimag mai nhi jaaarrriii hai iitna hard lagrae .... 😢😢😢😢😢😢😢😢
@janisarakhtar1075
@janisarakhtar1075 2 жыл бұрын
Sir n ki value 100 lekar kariye please sir please
@robinji6148
@robinji6148 2 жыл бұрын
🙏 🙏 🙏
@codeitup
@codeitup Жыл бұрын
🙂
@adnanchaudhary7276
@adnanchaudhary7276 3 жыл бұрын
Nice
@codeitup
@codeitup 3 жыл бұрын
Thanks Adnan!
@chinmoykumar1878
@chinmoykumar1878 4 жыл бұрын
Sir can't understand Edit: Actually I was too impatient. It is the best explanation
@codeitup
@codeitup 4 жыл бұрын
Ha ha ha, Keep Learning !
@chinmoykumar1878
@chinmoykumar1878 4 жыл бұрын
@@codeitup 😁😅
@vishalsisodiya1467
@vishalsisodiya1467 3 жыл бұрын
Sir I have one doubt that,why we have taken i=1.. Then in next line we have taken i=i+1...plz explain....
@codeitup
@codeitup 3 жыл бұрын
i is one because we have to find sum of first N natural number which starts from 1, and in order to increase it, we do i=i+1.
@vishalsisodiya1467
@vishalsisodiya1467 3 жыл бұрын
@@codeitup thnx👍👍👍👍
@mrkhan6416
@mrkhan6416 3 жыл бұрын
Can we use a for loop for this program?
@tejasvipratap9906
@tejasvipratap9906 3 жыл бұрын
can you explain django also
@vishnupavali5267
@vishnupavali5267 3 жыл бұрын
Sir I don't have pc , when I run this program in mobile , it's showing error bcoz , the txt which I'm entering after applying while loop is not inside it , even when I give space it's still showing error, pls help
@Art_mood
@Art_mood 3 жыл бұрын
esa isliye kyu ki while loop ke baad agr hm man se space dete h to accepct nhi hoti solution yhi h ki while loop ke baad jitna bhi space chhoti ho ya jitna bhi tab mila ho agla code whi se shuru krna chahiye
@ffsamuraisgamer8255
@ffsamuraisgamer8255 Жыл бұрын
BUT SIR IF CONDITION HAS BECOME TRUE, WHY THE PROGRAM WILL REEXECUTE
@hanirawat2741
@hanirawat2741 3 жыл бұрын
There is a formula also to find sum of first n natural numbers. It is n(n+1)/2
@codeitup
@codeitup 3 жыл бұрын
Yes, but you have to use your logic to do the work Hani !
@shivamchauhan3740
@shivamchauhan3740 3 жыл бұрын
sir my program is not running it showing errror after many corrections
@codeitup
@codeitup 3 жыл бұрын
Please paste your code here, I will modify.
@dineshvirat130
@dineshvirat130 3 жыл бұрын
Bro whether This program is odd or even??
@codeitup
@codeitup 3 жыл бұрын
I am not getting your question.
@viragsharma6982
@viragsharma6982 3 жыл бұрын
Sir can i watch class 12 python videos without watching class 11? As im class 12 and didn't study well in class 11☺😢😢😕😕😕😕😕
@codeitup
@codeitup 3 жыл бұрын
You can, but programming questions are in class 11 playlist.
@viragsharma6982
@viragsharma6982 3 жыл бұрын
@@codeitup will i understand class 12 then sir?..because there are 90+ videos of class 11..im still in 17th😢😢😢😢😢😢😢😢😢😢
@codeitup
@codeitup 3 жыл бұрын
@@viragsharma6982 Better would be to complete 11th first.
@MRAgundli
@MRAgundli Жыл бұрын
done
@codeitup
@codeitup Жыл бұрын
Ok
@SanjeevKumar-nc2rt
@SanjeevKumar-nc2rt 4 жыл бұрын
Anyone from coding ninjas??
@codeitup
@codeitup 4 жыл бұрын
Perhaps you are ! :)
@Theanonymous7394
@Theanonymous7394 4 жыл бұрын
yes ! i am...
@AkcrictekFantasy
@AkcrictekFantasy 4 жыл бұрын
Sum karne per hur ek ek number ko sum kar ke de raha py charm mai kya kare
@codeitup
@codeitup 4 жыл бұрын
print(sum) wale statement ko loop se bahar rakhie.
@sandeepsinghtomar7390
@sandeepsinghtomar7390 3 жыл бұрын
Sir please provide ur notes in pdf please the way u teach us supprbbbb
@adarshgupta9776
@adarshgupta9776 Жыл бұрын
why do u always use while loopssssssssssssssssssssssssssssssss
@UGWSUMIT
@UGWSUMIT Жыл бұрын
sir ye code mai same 2 same likh rha hu but nhi kra rha mood kharab krdiya 😮‍💨😒☹
@rkaa2967
@rkaa2967 2 жыл бұрын
Where are u from?????
@codeitup
@codeitup 2 жыл бұрын
Bihar 😊
@vsrpk369
@vsrpk369 4 жыл бұрын
A different way of looking at this problem kzfaq.info/get/bejne/Y7mBf8ubm9DDnoE.html
@codeitup
@codeitup 4 жыл бұрын
Nice Animation👍
@resmicn1916
@resmicn1916 3 жыл бұрын
how to find the sum of numbers 1to 50 in python
@codeitup
@codeitup 3 жыл бұрын
sum=0 for i in range(1,51): sum=sum+i print(sum)
@baulsagnik8355
@baulsagnik8355 Жыл бұрын
In my case the answer is not coming
@baulsagnik8355
@baulsagnik8355 Жыл бұрын
Sorry, it came..but came as 1,3,6,10,15...like I took 5...so why is it coming like this?
@sushanklamsal5413
@sushanklamsal5413 Жыл бұрын
@@baulsagnik8355 I think you have used print In loop . You should used print outside loop. Just type little forward
@progamer-oc3ql
@progamer-oc3ql 5 ай бұрын
ye sab bakwas hai coding kuch nhi hain
@ashishbansode8736
@ashishbansode8736 3 жыл бұрын
thank you sir
@faizalkhalifa9187
@faizalkhalifa9187 3 жыл бұрын
Thanks sir
@codeitup
@codeitup 3 жыл бұрын
Most welcome dear!
Solve any Star Pattern program in Python
18:44
Simply Coding
Рет қаралды 929 М.
Underwater Challenge 😱
00:37
Topper Guild
Рет қаралды 42 МЛН
WILL IT BURST?
00:31
Natan por Aí
Рет қаралды 30 МЛН
拉了好大一坨#斗罗大陆#唐三小舞#小丑
00:11
超凡蜘蛛
Рет қаралды 14 МЛН
All Python Syntax in 25 Minutes - Tutorial
24:59
Beau
Рет қаралды 36 М.
Print First N Natural Number in Reverse Order - In Hindi
8:19
Python Tutorial for Absolute Beginners #1 - What Are Variables?
24:38
11 Tips And Tricks To Write Better Python Code
11:00
Patrick Loeber
Рет қаралды 610 М.
Underwater Challenge 😱
00:37
Topper Guild
Рет қаралды 42 МЛН