0

// C Program to demonstrate

// Sum of Natural Numbers

// using while loops

#include <stdio.h>

int main()

{

int i, s = 0;

int n = 10;

i = 1;

// while loop executes

// the statements until the

// condition is false

while (i <= n) {

// adding natural numbers

// up to given number n

s += i;

i++;

}

// printing the result

printf(“Sum = %d”, s);

return 0;

}

Pavatharni . S Asked question June 6, 2023