WK6 - 41 Algorithm Sum of natural numbers from 1 to N

preview_player
Показать описание
#link to lecture slides
Рекомендации по теме
Комментарии
Автор

sir we can do directly by using formula
n(n+1)/2 I.e the sum of first natural number

Aman_Gupta-rl
Автор

Sir, If we use Print in btw Do While loop As
/* WHILE ( num<=N) DO
sum<--sum +num
Print sum
num<--- num + 1
END-WHILE
*/

karanpratapsinghrautela
Автор

Sir, why we writing "num=num+1", when we already ask it to reiterate each time in for parentheses

rockerz
Автор

Sir N denotes the last last number. Does N need a memory location ?

ankitaswal