Computer Science, asked by sukantisukantiswain, 4 months ago

Q.1 programme to print the no from 10 to 1 using while loop.
Q.2 programme to print the no. from 1 to n using while loop.
Q.3 programme to print the sum of n natural no. from 1 to n using while loop...​

Answers

Answered by harshvirsing55
4

Answer:

PROGRAM IN PYTHON LANGUAGE

Ans.1

n=10

while n>=1:

   print(n)

   n-=1            #n=n-1

Ans.2

n=int(input('Enter your no.:-'))

i=1

while i<=n :

   print(i)

   i+=1            #i=i+1

Ans.3

sum=0

n=int(input('Enter your no.:-'))

i=1

while i<=n :

   sum+=i

   i+=1          #i=i+1

print('sum of natural no. from 1 to',n,'is', sum)

Answered by jai696
1

\huge\red{\mid{\fbox{\tt{Using\: Python\: 3}}\mid}}

# Q.1 programme to print the no from 10 to 1 using while loop.

counter = 10

while counter != 0:

print(counter)

counter -= 1

# Q.2 programme to print the no. from 1 to n using while loop.

n = int(input("n: "))

counter = 1

while counter != n + 1:

print(counter)

counter += 1

# Q.3 programme to print the sum of n natural no. from 1 to n using while loop...

n = int(input("n: "))

counter = 1

_sum = 0

while counter != n + 1:

_sum += counter

counter += 1

print(f"sum: {_sum}")

\large\mathsf\color{lightgreen}useful?\: \color{white}\longrightarrow\: \color{orange}brainliest!

Similar questions