http://pixs.ru/showimage/123456png_5542353_19809571.png
Код: Выделить всё
double P=3.14,x, y, h, e, a, z;
x=P/5; h=P/10; e=0.000001;
do
{
y=y+cos((2*n)-1)*x/pow((2*n-1),2);
n++;
a=cos((2*n)-1)*x/pow((2*n-1),2);
}
Код: Выделить всё
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<stdlib.h>
main(int argc,char* argv[])
{
int i,n;
double P=3.14,x, y, h, e, a, z;
x=P/5; h=P/10; e=0.000001;
printf("Rozhin Pavel,IVT-12\n");
printf("Sostavit' tablicy funkcii zadannoi konechnoi summoi\n");
printf("___X___ Y ___ Z ___ \n");
printf("----------------------------\n");
for (i=1; i<10; i++)
{ n=0; y=0; z=0;
do
{
y=y+cos((2*n)-1)*x/pow((2*n-1),2);
n++;
a=cos((2*n)-1)*x/pow((2*n-1),2);
}
while (fabs(a)<e);
z=(((P*P)/8)-P/4)*x;
printf("| %.3lf | ",x);
printf("%.5lf | ",y);
printf("%.5lf | \n",z);
printf(" ");
x=x+h;
}
printf("--------------------------\n");
printf("Press Enter\n");
system("pause");
}