Skip to content
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
🔒 Locked · start free trial →

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 n(n+1)2=89×902=4005\dfrac{n(n+1)}{2}=\dfrac{89\times 90}{2}=4005.)

#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.