Advertisement
Guest User

Untitled

a guest
May 27th, 2015
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <conio.h>
  3. #include <stdlib.h>
  4. #include <math.h>
  5.  
  6. int summ(int quantity, int parametr, ...)
  7. {
  8. int sum=0, *p=&parametr;
  9. while (quantity--)
  10. {
  11. sum+=pow(*p,2); //âîçâåäåíèå â ñòåïåíü
  12. p++;
  13. }
  14. return sum;
  15. }
  16. int main()
  17. {
  18. printf("summ = %i\n", summ(2, 3, 5, 7, 9, 1));
  19. printf("summ = %i\n", summ(7, 1, 2, 1, 1, 1, 1, 1));
  20. printf("summ = %i\n", summ(4, 0, 0, 4, 4));
  21. getch();
  22. return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement