DEV Community

Kelechi Otugbuali
Kelechi Otugbuali

Posted on

Calculate the sum of squares of given input of numbers

OBJECTIVES:

  1. Create the algorithm in a flow chart

  2. Create pseudo code

PSEUDOCODE

Read num;
Set Sum=0;
For (set Counter = 1 ; Counter<num+1; Counter++){

Sum+= Counter * Counter;

}
Print Sum;

Flow Chart

Image description

CODE (Javascript)
//Assuming we are using 4 as the value//
let num =4;
let sum=0;
for (let i = 0; i < num+1; i++) {
sum += i * i ;
}
return sum;

Top comments (0)