1
, .
1
:
k = 5
x = 1
:
S = 0.707+3.016+7.517+14.672+24.878
S = 24.878
3.3 - 1
3.4 ++ 1
// ( for)
#include <iostream.h>
#include <math.h>
using namespace std;
int main()
{
int k,x;
cout<<"\nVvod k,x";
cin>>k>>x;
float s=0;
for (int n=1;n<=k;n++)
s=s+n*n/sqrt(n+x);
cout<<"\ns="<<s;
}
// ( do..while)
#include <iostream.h>
#include <math.h>
using namespace std;
int main()
{
int k,x;
cout<<"\nVvod k,x";
cin>>k>>x;
float s=0;
int n=1;
do
{
s=s+n*n/sqrt(n+x);
n++;
}
while(n<=k);
cout<<"\ns="<<s;
}
// ( while)
#include <iostream.h>
#include <math.h>
using namespace std;
int main()
{
int k,x;
cout<<"\nVvod k,x";
cin>>k>>x;
float s=0;
int n=1;
while(n<=k)
{
s=s+n*n/sqrt(n+x);
n++;
}
cout<<"\ns="<<s;
}
2
, , , .
2
: a = 12
:
f(-2.00) = 100.00 - 100
f(-1.70) = 106.09 - 106
f(-1.40) = 112.36 - 112
f(-1.10) = 118.81 - 118
f(-0.80) = 125.44 - 125
f(-0.50) = 132.25 - 132
f(-0.20) = 139.24 - 139
f(0.10) = 146.41 - 146
f(0.40) = 153.76 - 153
f(0.70) = 161.29 - 161
f(1.00) = 169.00 - 169
f(1.30) = 176.89 - 176
f(1.60) = 184.96 - 184
f(1.90) = 193.21 - 193
f(2.20) = 201.64 - 201
f(2.50) = 210.25 - 210
f(2.80) = 219.04 - 219
- 2
3.8 C ++ 2
//( dowhile)
#include <iostream.h>
#include <math.h>
using namespace std;
int main()
{
int k,a;
float x,f;
cout<<"\nVvod k,a";
cin>>k>>a;
x=-2;
do
{
f=(x+a)*(x+a);
cout<<"\nf="<<f<<"\tx="<<x;
|
|
if ((int) f % 2!= 0)
cout<<"\nCelaya chast"<<(int)f<<" necetnaya";
else
cout<<"\nCelaya chast"<<(int)f<<" cetnaya";
x=x+0.3;
}
while (x<=3);
}
//( while)
#include <iostream.h>
#include <math.h>
using namespace std;
int main()
{
int k,a;
float x,f;
cout<<"\nVvod k,a";
cin>>k>>a;
x=-2;
while (x<=3)
{
f=(x+a)*(x+a);
cout<<"\nf="<<f<<"\tx="<<x;
if ((int) f % 2!= 0)
cout<<"\nCelaya chast"<<(int)f<<" necetnaya";
else
cout<<"\nCelaya chast"<<(int)f<<" cetnaya";
x=x+0.3;
}
}
//( for)
#include <iostream.h>
#include <math.h>
using namespace std;
int main()
{
int k,a;
float x,f;
cout<<"\nVvod k,a";
cin>>k>>a;
for (x=-2;x<=3;x=x+0.3)
{
f=(x+a)*(x+a);
cout<<"\nf="<<f<<"\tx="<<x;
if ((int) f % 2!= 0)
cout<<"\nCelaya chast"<<(int)f<<" necetnaya";
else
cout<<"\nCelaya chast"<<(int)f<<" cetnaya";
}
}
3.9
1) ?
2) - .
3) .
4) .
5) , ?
6) ?
7) ?
4