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.
(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
Comments
Leave a comment