Computer Science, asked by shvmjindal56, 3 months ago

write a program in c to find sum of natural numbers using for loop​

Answers

Answered by Anonymous
20

Answer:

  • Using while Loop

#include <stdio.h>

#include <conio.h>

void main()

{

int num, i, sum = 0; // initialize and declare the local variables.

printf("Enter a positive number : ");

scanf("%d", &num); // take a value up to which find the sum of n natural number.

i = 0;

Similar questions