An algorithm to find and print the sum of first n natural number using while loop.

1) START

2) Initialize loop counter i=1 and Sum=0

3) Enter any natural number as N

4) Check is i <= N if TRUE then continue ELSE Goto Step 8

5) Sum= Sum + i

6) Increment value of i by 1 i.e  i++

7) GOTO Step 3

8) Print Value of Sum

9) END

Flowchart to find and print the sum of first n natural number using while loop.

C-Code to find and print the sum of first n natural number using while loop.

```#include<stdio.h>
void main()
{
int i,n,sum=0;
i=1;
printf(“Enter any natural number to print add”);
scanf(“%d”,&n);
while(i<=n)
{
sum=sum+i;
i=i+1;
}
printf("\n The addition of numbers 1 to N is :%d",sum);
}```

An algorithm to find and print the sum of first n natural number using do….while.

1) START
2) Initialize loop counter i=1 and Sum=0
3) Enter any natural number as N
4) Sum= Sum + i
5) Increment value of i by 1. i.e i++.
6) Check is (i <= N ) if TRUE then Goto Step 4
7) Print Value of Sum
8) END

C-Code to find and print the sum of first N natural number using do… while loop.

```#include<stdio.h>
void main()
{
int i,n,sum=0;
i=1;
printf(“Enter any natural number to print add”);
scanf(“%d”,&n);
do{
sum=sum+i;
i=i+1;…
}while(i<=n);
printf("\n The addition of numbers 1 to N is :%d",sum);
}```

C-Code to find and print the sum of first N natural number using for loop.

```#include<stdio.h>
void main()
{
int i,n,sum=0;
printf("Enter any number you want to perform addition :");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
sum=sum+i;
}
printf("\n The addition of numbers 1 to 10 is :%d",sum);
}```