Write a program to print sum of natural number between 1to7
Answers
Answered by
0
Answer:
1. #include <stdio.h>
2. int n, i, sum = 0;
3. printf("Enter a positive integer: ");
4. scanf("%d", &n);
5. for (i = 1; i <= n; ++i) {
6. sum += i;
7. }
8. printf("Sum = %d", sum);
hope it helps u mark as brainliest n follow plz.
Answered by
0
Explanation:
sum= Ø
for n in a range (1,8)
⠀⠀⠀sum += n
print "sum =", n "is", sum
hope this helps you
Similar questions