menu search
brightness_auto
more_vert
C Program to Find the Sum of First N Natural Numbers
thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike

1 Answer

more_vert
 
verified
Best answer
#include <stdio.h>
#include <conio.h>
 
int main(){
      
    int numberCount=0, number, counter, sum=0;
     
    printf("Enter the number of integers to add: ");
    scanf("%d",&numberCount);
     
    printf("Enter %d numbers seperated by space \n", numberCount);
    for(counter = 0; counter < numberCount; counter++){
        scanf("%d", &number);
        sum = sum + number;
    }
    printf("SUM = %d", sum);
    getch();
    return 0;
}

 

thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike

Related questions

thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
1 answer
thumb_up_off_alt 1 like thumb_down_off_alt 0 dislike
0 answers
thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
1 answer
thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
1 answer
thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
1 answer
thumb_up_off_alt 1 like thumb_down_off_alt 0 dislike
1 answer

Doubtly is an online community for engineering students, offering:

  • Free viva questions PDFs
  • Previous year question papers (PYQs)
  • Academic doubt solutions
  • Expert-guided solutions

Get the pro version for free by logging in!

5.7k questions

5.1k answers

108 comments

648 users

...