/*
@author Kamil Nowak
@subject Projekt 29 - laboratorium 1
Prawdopobnie przeoczyłem informacje co należy zrobić z podanymi wyrażeniami na kartce.
Jeśli to rozwiązanie jest niepoprawne, proszę o wiadomość email.
*/
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <cmath>
static int setAmount();
static void series();
static void interval();
static void arctg();
int main()
{
printf("--------------------------------------------------------\n");
printf("--------------------------------------------------------\n");
printf("[3] Suma szeregu n-elementowego\n");
printf("--------------------------------------------------------\n");
switch (ch)
{
case '1': {
arctg();
break;
}
case '2': {
interval();
break;
}
case '3': {
series();
break;
}
case '0': {
break;
}
default:
main();
break;
}
main();
return 0;
}
void arctg() {
double x = 0.0;
printf("--------------------------------------------------------\n");
printf("-------------------------------------------------------\n");
printf("Arcus tangens z %0.5f jest rowny %0.5f\n", x
, atan(x
));
}
void interval() {
double x = 0.0;
printf("--------------------------------------------------------\n");
printf("-------------------------------------------------------\n");
if (x < 1 && x > -1)
printf("Liczba %0.5f spelnia nierownosc\n", x
);
else
printf("Liczba %0.5f nie spelnia nierownosci\n", x
);
}
void series() {
int n = 0;
double x = 0.0;
printf("--------------------------------------------------------\n");
printf("Podaj pierwszy element szeregu: ");
n = setAmount();
printf("\n--------------------------------------------------------\n");
double sum = 0;
for (int i = 0; i < n; i++) {
sum
= sum
+ pow(x
, 1 + 2 * i
) / (1 + 2 * i
) * pow(-1, i
);
}
printf("--------------------------------------------------------\n");
printf("Suma szeregu %i-elementowego z pierwszym elementem %0.5f jest rowna: %0.5f", n
, x
, sum
);
printf("--------------------------------------------------------\n");
}
int setAmount()
{
int n = 0;
if (n <= 0) {
printf("Cos poszlo nie tak!\n");
main();
}
return n;
}
{"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"}