#include <iostream.h> #include <math.h> int mypow(int a, int b) { if(b==0) return 1;int res=1; for(int i=0;i<b;i++) res*=a; return res; } int fact(int n) { if(n==0)return 1; return n*fact(n-1); } void main() { cout << "Zada4a 1" << endl; int n;double x; cout << "Input N: "; cin >> n; cout << endl; cout << "Input X: "; cin >> x; cout << endl << "------------"<<endl; double res=0; for(int i=0;i<n;i++) { res += mypow( -1, i) * ( mypow(x, 2*i)/fact(2*i) ); } cout << "Result: "<<res; }
#include <iostream.h> #include <math.h> void main() { double a,b,x; cout << "Input A: "; cin >> a; cout << endl; cout << "Input B: "; cin >> b; cout << endl; cout << "Input X: "; cin >> x; cout << endl; cout << b*( log(5+a*x)/log(5) ); // (*) }
double mypow(double a, int b) { if(b==0) return 1;double res=1; for(int i=0;i<b;i++) res*=a; return res; }