Write a code that displays the sum of first 10 natural number
by using for loop
Answers
Answered by
0
Answer:
Explanation:
C For Loop: Exercise-2 with Solution
Pictorial Presentation:
Sample Solution:
C Code: #include <stdio.h> 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); } ...
Flowchart:
C Programming Code Editor:
Mark as brainlist ❤❤❤
Do not copy my answer ⚠️⚠️⚠️⚠️
Answered by
1
sum = 0
for i in range(1,11):
sum += i
print("Sum of first 10 natural numbers = ", sum)
Similar questions