Первое:
Код:
#include <iostream>
#include <cmath>
using namespace std;
void main()
{
float a, s, e = 20;
int n = 1;
do
{
a = (powf(3, n)*n)/(2*n);
// cout << a << endl;
if (fabsf(a) >= e)
{
s+= a;
cout << a << endl;
}
n++;
} while (n < 10);
cout << "\n=========\n s = " << s << endl;
}
Третье:
Код:
#include <iostream>
#include <string>
using namespace std;
void main()
{
for (int i = 10; i < 100; i++)
{
char tmp[2], n1[2], n2[2];
itoa(i, tmp, 10);
n1[0] = tmp[0]; n1[1] = '\0';
n2[0] = tmp[1]; n2[1] = '\0';
int t1 = atoi(n1);
int t2 = atoi(n2);
cout << "i = " << i << endl;
if (i == (t1*t2*3))
{
cout << "matched i: " << i << endl;
}
}
}
Второе потом. Или напиши решение, лень искать\повторять\решать сейчас те три метода.