# plz tell me the coding of this question

asked Oct 30, 2017
Q: find the sum of n natural numbers?

answered Nov 2, 2017 by (140 points)
int sumofnatural(int n)
{
int sum = 0;
for (int i = 0; i < n; i++)
{
sum += i;
}
return sum;
}
commented Nov 3, 2017 by (300 points)
you give  wrong coding i was run this code on turbo then it gives error like(/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status)
commented Nov 4, 2017 by (140 points)
This is a function that you would have to call in main. Example
#include <stdio>

int main()
{
cout << sumofnatural(9) <<endl;
return 0;
}
commented Nov 5, 2017 by (300 points)
oky i wil try it
commented Nov 5, 2017 by (300 points)
in which city you can belong are you a programmer
commented Jan 24, 2018 by (270 points)
are you a programmer? xD @questioner
answered Nov 8, 2017 by anonymous
o recorde mundial de velocidade no solo e de 1228 km/h atingindo por um carro movido a jato essa velociade no SI seria de
commented Apr 7, 2019 by anonymous
yes iam a programmer
fiya
answered Nov 8, 2017 by anonymous
```#include <stdio.h>
int main()
{
int n, i, sum = 0;

printf("Enter a positive integer: ");
scanf("%d",&n);

for(i=1; i <= n; ++i)
{
sum += i;   // sum = sum+i;
}

printf("Sum = %d",sum);

return 0;
}
```

commented Nov 8, 2017 by (300 points)
sorry if you dont mind i dont understand your language can you plz explain in english:D
commented Nov 8, 2017 by anonymous
expected output

Enter a positive integer: 8
Sum = 36

...Program finished with exit code 0
Press ENTER to exit console.
commented Nov 8, 2017 by (300 points)
thank you so much