Sum of Numbers Program using while loop : Python tutorial 51

preview_player
Показать описание
Guys please help this channel to reach 20,000 subscribers. I'll keep uploading quality content for you.

Python is easy programming language to learn and anyone can learn it, and these tutorials are 100% free in hindi.

You can share this playlist with your brother, sisters and friends. This will surely add some values to their life.

If you follow this complete playlist of python tutorial surely you will learn everything about python programming language.

Program using while loop

Рекомендации по теме
Комментарии
Автор

Subject: Heartfelt Thanks for Your Invaluable Solution

Dear Harshit Vashisth,

I wanted to take a moment to express my sincere gratitude for the solution you provided. Your expertise and thoughtful approach not only resolved the issue at hand but also shed light on new perspectives. Your willingness to help and the clarity of your solution were truly remarkable.

I am deeply appreciative of the time and effort you invested in assisting me. Your guidance has been instrumental, and I am grateful to have someone as knowledgeable and generous as you in my network.

Thank you once again for your invaluable contribution. Your support has made a significant difference, and I feel fortunate to have received your assistance.

Warm regards,

Rohan Kumar

RohanKumar-cehd
Автор

Tip :
It took me 1 hr to understand this. The explanation here is very incomplete.
For every loop the value of Total & i gets increased and then program is executed till i reaches 10.
To understand better write the print line after Total+=i & then write the i+=1 line.
Also the output shows like this
1
3
6
10
15
21
28
36
45
55
Write all the loops with resp. values in the notebook, you will have no doubt left i guarantee. 🙂

ramannaagre
Автор

total = 0 #initalise total
i = 1 # initalise i
while i <= x: # while loop where x is the number you want to sum to
total = total + i #summing over iterations
i = i + 1 #increasing counter i
print(total) #return sum

Neddiek
Автор

if anybody has confusion, so i will recommend you to print (i) and then match or compare both results.
it will help

ShortVine
Автор

#Hey guys try this vedio for user input


print("\n")

a = int(input("Enter 1st number : "))

print(f"\n")

b = int(input("Enter last number : "))

sum=0
a=1
while a<=b:
sum+=a
a+=1
print("\n")
print(f"The sum of {a} to {b} is {sum}")




Take love from Bangladesh.

avilashbhowmik
Автор

i = 1
total = 0
while i<=10:
total +=i
i+=1
print(f"sum of first {i} number is {total}")
ese bhi llikh sakte hai

itbase
Автор

S=0
For i in range(10):
S+=i
Print(S)

IQ_reviews
Автор

Hi Harshit, I have one question about the above example. Total and i variable will consider as a string then how it is adding up the value and displaying the correct sum without changing it to integer value

gayatriutreja
Автор

Sir why I'm not getting Same output what you got ??
I got
1
3
6
And so on to 55

Sunilkumar-kfxj
Автор

sir 1st method se answer right aayega hi nhi aap agr ho ske toh 1st method se aur solutions solve kr kai dikha dengai toh best hoga smjhne kai liye pls but 1st method se 2method se nhi
dono method se different -2 answers aayega

inderpalsingh
Автор

in this when i check out put i get whole number sequece of procedure like 1 3 6 till 55 and u get direct ans where its go that way ?

mayurdube
Автор

#sum of n natural numbers:
def _sum(n):
i=1
add=0
while i<=n:
add=add+i
i+=1
return(add)

N=int(input("enter value of n :"))
addition=_sum(N)
print(f"sum of {N} natural number is {addition}")

whitemice
Автор

Hi Harshit,
After using same code i am getting below output
1
3
6
10
15
21
28
36
45
55

I am unable to find why output is not same as yours, could you please help

souvikghosh
Автор

Hiii.... Harshit.... Can you please help me in some coding. Actually, I am student of Master of data science in Australia.

kkgill
Автор

please upload all chapter i want to learn scrapping tool and web and exe ui

ITproConnects
Автор

Sir AAP java ka content complete Karo sir please 🥺🥺🥺🥺

TabrezAlikhan
Автор

sum = 1
while sum<=10:
print(sum + 0)
sum = sum + 1

popularseriessongs
Автор

Total=1, 3, 6, 10, 15, 21, 28, 36, 45, 55

nirock
Автор

Bhai mene 10th ka A.P wale chapter me sum of numbers ka ek formula tha mene is while loop se wo solve krne ki koshish ki jese
#sum of numbers using while loop
first_num = int(input("hey user type first number here : "))
last_num = int(input("hey user type last number here : "))
while first_num <= last_num:
last_num += first_num
first_num += 1
#end

Bhai mene ye bnaya bu program start nhi ho rha while loop se 😵

mohanbarman
Автор

Press tab before print, to understand logically!

sanketsanghi
welcome to shbcf.ru