// zadanie3.cpp: Definiuje punkt wejścia dla aplikacji konsolowej.
//
#include "stdafx.h"
#include <stdlib.h>
#include <math.h>
double suma(double x_f, int n_f);
double silnia(int licz);
int main()
{
int x = 1;
int n;
double abc = 1234.123;
//const double E = 2,7182818284590452;
printf_s("Podaj liczbe składnikow nn");
scanf_s("%d", &n);
abc = suma(x, n);
printf_s("%lf", abc);
system("pause");
return 0;
}
double silnia(int licz)
{
double sil = 1;
for (int i = licz; i > 0; i--)
{
sil *= i;
}
printf("silnia to %lfn", sil);
return sil;
}
double suma(double x_f, int n_f)
{
double sum = 1;
for (int j=1; j<=n_f; j++)
{
sum += pow(x_f, (double)j / silnia(j));
}
return sum;
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}