Square terms series – CSKC
Sign In

Search

Code Learning #CPP#2353    siteicon   siteicon  

Square terms series

Printing 10 terms of square terms of natural numbers beginning from 1.

Learning Objectives

  • Using the series progression logic in the loop.

Source Code

TC++ #2353

 

Source Code

×

Ask AI About This Code

Default Prompt that is passed along with the code is given below, You can write your own prompt if you so desire.



×

Test CPP

Code Understanding

for(int i=1;i<=10;++i)
This is simple for loop starting from 1 and ending at 10 with step of 1 with each iteration.

cout<<i*i<<” “;
The series logic is simply squaring the loop index number and then adding a space after words.

 

Notes

  • Simple series may use the index number as the term calculator, but for most series applications we can use index for only the term count and term calculation logic may not depend on index number.

Common Errors

  • Student make commonย  mistake in writing i<10 in place ofย  i<=10.


Suggested Filename(s): sq-series.cpp



Share

Created: 8-Jan-2018 01:26 | Updated: 15-Sep-2018 12:47|