Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- #include<math.h>
- double summation(long* N);
- int main(void)
- {
- printf("summation of squares of first N numbersn");
- printf("enter Nn");
- long* N;
- *N = 0;
- scanf("%lin",N);
- double su;
- su = summation(N);
- printf("The summ equals %.lfn", su);
- return 0;
- }
- double summation(long* N)
- {
- double S = 0;
- int i;
- for (i = 1; i <= *N; i++)
- S = S + pow(i, 2);
- return S;
- }
- long* N;
- *N = 0;
- scanf("%lin", N);
- long N;
- N = 0; // this is somewhat useless BTW, because N will be modified in the line below
- scanf("%lin", &N);
Add Comment
Please, Sign In to add comment