

InterviewSolution
Saved Bookmarks
1. |
Write a C program to find sum of first 10 natural numbers using do while loop |
Answer» Answer: #include void main() { int j, sum = 0; PRINTF("The first 10 natural number is :\n");
for (j = 1; j <= 10; j++) { sum = sum + j; printf("%d ",j); } printf("\NTHE Sum is : %d\n", sum); } Output: The first 10 natural number is : 1 2 3 4 5 6 7 8 9 10 The Sum is : 55 |
|