1.

Write an algorithm to find the cube of first n natural numbers (eg: 1, 8, 27, …., n3)

Answer»
  • Step 1: Star 
  • Step 2: Set i ← 1 
  • Step 3: Read a number and store in n 
  • Step 4: Compare i and n if i > n then go to step 7 
  • Step 5: Print i × i × i 
  • Step 6: i ← i + 1 go to step 4 
  • Step 7: Stop


Discussion

No Comment Found

Related InterviewSolutions