Answer to Question #287340 in Python for Rox

Question #287340

For every program, there should be a softcopy file containing (i) Algorithm/Flowchart, (ii)

Source Code, (iii) Output

Q.1. Write a program to find squres and cubes of first n natural numbers.


1
Expert's answer
2022-01-13T09:39:25-0500
(i) Algorithm 
Start  
   Declare variable n
   Read n
   for i=0 to 
       Set squres=i*i   
       Set cubes=i*i*i   
       Display i,squres,cubes
Stop
(ii) Source Code
n=int(input("Enter n: "))
for i in range(0,n):
    squres=i*i
    cubes=i*i*i
    print(f"{i}\t\t{squres}\t\t{cubes}")

(iii) Output




Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS