Advertisement
fqrmix

Lab 3 | 10 var

Oct 10th, 2016
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.04 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. #include <iostream>
  4. float x(float valuea, float valueb, float valuec, float i){
  5.     return sqrt((pow(i,2)+valuea+valuec)/valueb*pow(i,2)+i*valuec+valuea);
  6. }
  7. float y(float valuea, float valueb, float valuec, float i){
  8.     return valuea*log(valueb*i + valuec)+valueb*pow(i,2);
  9. }
  10. float summ(int start, int end, float valuea, float valueb, float valuec, char c, float identify){
  11.     int i;
  12.     float result_returned = 0;
  13.     switch (c)
  14.     {
  15.     case 'x':
  16.         for (i = start; i < end; i++)
  17.             result_returned += x(valuea, valueb, valuec, i)*identify;
  18.         break;
  19.     case 'y':
  20.         for (i = start; i < end; i++)
  21.             result_returned += y(valuea,valueb,valuec,i)*identify;
  22.     }
  23.     return result_returned;
  24. }
  25. int main(void){
  26.     float a, b, c;
  27.     float result;
  28.     printf("Введите a,b,c\n");
  29.     scanf_s("%f %f %f",&a,&b,&c);
  30.     result = pow(summ(4, 11, a, b, c, 'x', 1.0), 2) + 0.6*summ(2, 7, a, b, c, 'y', 1.0) + sqrt(summ(6, 10, a, b, c, 'x', 0.2) + summ(3, 5, a, b, c, 'y', 1.0));
  31.     printf("%f\n",result);
  32.     system("pause");
  33.     return 0;
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement