Computer Science, asked by fanuja101, 1 year ago

find the sum of a number using while loop

Answers

Answered by AmudhavelVchamp
1
#include<stdio.h>

int main()

{

  int Number, i = 1, Sum = 0;

  

  printf("\nPlease Enter any Integer Value\n");

  scanf("%d", &Number);

  

  while(i <= Number)

  {

     Sum = Sum + i;

     i++;

  }

   printf("Sum of Natural Numbers = %d", Sum);

  return 0;

}

(actually which language u need )
Similar questions