Write a program in python to print 1 to 50 numbers.
Answers
Answered by
27
i=1
while(i<=50):
print(i)
i=i+1
--------------------
⬆⬆⬆⬆⬆⬆⬆⬆this was using while loop
-------------------
for i in range(51):
print(i)
-------------------
⬆⬆⬆⬆⬆⬆this was using for loop
-------------------
.
.
Mark it and follow me dude✌✌❣❣❣❣❣
Answered by
3
Below are the Output and the python program for the above question :
Output: "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 "
Explanation:
for x in range(1,51):#For loop which runs from 1 to 50 and access the number.
print(x,end=" ")#print the number.
Code Explanation :
- The above code is in Python language, which holds one for loop which runs for the value of 1 to 50.
- Then the print statement will prints every value from one to 50 using x variable, because the x variable will scan the all element one by one.
Learn More ;
- Python program : https://brainly.in/question/12744042
Similar questions