Question Bank (5 marks) · Q16
Q.Write a C program to print the sum of the first 89 natural numbers.
Karnataka PUCTextbookLong· 5mImportance★★★★★est
54% · 83/154 Questions
You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.
Start your 14-day free trial to unlock the full solution →[!TLDR]
Loop i from 1 to 89 adding each value; the sum of the first 89 natural numbers is 4005.
The first 89 natural numbers are 1, 2, 3, ..., 89. A for loop runs the index from 1 to 89 and accumulates the total in sum. (The same result is given by the formula .)
#include <stdio.h>
int main()
{
int i, sum = 0;
for (i = 1; i <= 89; i++)
sum += i; …
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.