Here is my code:
https://github.com/cortesivan96/WSQs/blob/master/Number%20E%20(WSQ14)
]]>
Here is my code:
]]>It was a little difficult and had to look for help with other people from the course
Here's the link: WSQ14
]]>It was a little difficult and had to look for help with other people from the course
Here’s the link: WSQ14
]]>Code: wsq14
]]>//WSQ14 Euler
#include <iostream>
#include <cmath>
using namespace std;
float fact (float e) {
int q,w;
q = 0;
w = 1;
while (q<e) {
w = w*(q+1);
q = q+1;}
return w;}
// x=número de factorial al que llegará el denominador
int main(){
cout<<“¿Con qué precición quieres el número de euler?”<<endl;
float x;
cin>>x;
int i=1;
float penu;
float s=1;
do{
penu=s;
s=s+1/fact(i);
i=i+1;
} while (abs(s-penu)>x);
cout<<“El número de Euler es “<<s<<endl;
return 0;}
Here is my code to wsq14, hate euler, love euler, our relationship is complicated 3
My code in github: https://github.com/VanessaBaeza17/wsq14/blob/master/code
]]>Here is my code to wsq14, hate euler, love euler, our relationship is complicated 3
My code in github: https:/
After having done the #Quiz11, this WSQ was one of the easier ones, even if it took a lot of digging in StackOverflow and cplusplus.com, looking at details of semi-finished code from beginners (like me, obviously) with the same problems as myself.
e’s an awesome number, check the GitHub code link for the WSQ.
]]>Foto: https://flic.kr/p/9ine9G
En este WSQ tuve algunos problemas porque al momento de hacer la función me equivocaba en los valores de la variable, pero le pedi ayuda a un amigo y lo arregle. Aquí esta mi código:
]]>long double precision( int n, long double e)
{
if (n == 0){
return ceil (e);
} else if (n == 1){
return floor ((e * 10 ) + 0.5) / 10;
}else if ( n ==2){
return ceil((e * 100 ) + 0.05) / 100;
} else if ( n == 3){
return floor ((e * 1000 ) + 0.005) / 1000;
} else if (n == 4){
return floor ((e * 10000 ) + 0.0005) / 10000;
}else {
return e;
}
}
long double calculate_e (){
long double e = 2.5;
long double c = 2.0;
long double d, factorial;
for (int i=0;i<5;i++){
c = c + 1.0;
d = c;
factorial = c;
while (d>1){
d = d – 1.0;
factorial = factorial * d;
}
e = e + (1.0/factorial);
}
return e;
}
int main(){
int n;
cout << “numero de decimales que desees entre 0 y 5″<< endl;
cin>> n;
long double e = calculate_e ();
long double e2 = precision(n, e);
cout << e2 << endl;
return 0;
}
This one was really difficult, at first I didn’t understand what to do but I read the link that was on the wsq and read other post to understand what to do.
]]>