C.Sum of first 10 natural numbers using do while loop

#include<stdio.h>

int main()

{

   int j,sum=0;

      printf("The first 10 natural number is:\n");

do

{

    j++;

    sum=sum+j;

    printf("%d",j);

}while(j<10);

printf("\n The sum is %d",sum);

return 0;

}

Comments