Yo Soy 196

Captura de pantalla 2016-04-07 a las 15.34.05Captura de pantalla 2016-04-07 a las 15.34.35Captura de pantalla 2016-04-07 a las 15.35.15

We needed to create a program that asks the user for two pieces of data:

  • The lower bound of the sequence
  • The upper bound of the sequence
Then you check the values from the lower bound (inclusive) to the upper bound (inclusive) and make a report of them. During the analysis of each number, if a Lychrel number is found it should be reported immediately with something like “Found a Lychrel number: 196”
One of my friends, Lalo Maciel, helped with this assignment so here it is.
This page helped also. https://mattmccutchen.net/bigint/

Here’s my code in GitHub.

Quiz 4

We created a function called euler_calc with a single parameter precision. The value of precision is used to determine when to stop calculating. Your calculation will stop when the two consecutive values estimating e differ by less than precision. For example:

Captura de pantalla 2016-04-07 a las 14.13.26

In this code, you’ll need also another function for a factorial because de euler number has this formula:  Captura de pantalla 2016-04-07 a las 14.19.44

so it is 1/factorial with a limit until when the two consecutive values estimating e differ by less than precision. And the precision will be as short or long as you want.

If you calculate the e number on a scientific calculator, the number will be 2.718281828.

First you write the euler function like this euler_cacl (float precision) , with the 2 floats variables, e for the answer, prev for the previous e value; and 1 int = n. Then there’s the loop Do While, and will do e = e / (1/factorial(n)).

The factorial function must be like this, because you can’t have 0* n, because it will return you 0, and you can’t have a 0 as a divisor.

For the While in the euler function, must be while ((e-prev)>precision). The the loop will stop and you will have the answer which is “e”.

Here’s my GitHub link.
https://github.com/antonioangelm24/TC101/blob/master/Quiz%204

 

QUIZ 3

This quiz took me a while, not only because I finished it on last class, but I haven’t had time in the partials week.
Anyway, the first quiz was kind of easy because you only needed to follow the formula of the distance of two points in the plane.

 

So I look up in google for the formula and I found this one on http://www.elosiodelosantos.com/sergiman/div/formula_dos_puntos.htm
and the formula wasdistancia_0 and I just create the function of the program based on the formula.
Also, I needed to include the cmath library, in order to be able to use  “sqrt” that is the square root. One of my classmates told me that.Captura de pantalla 2016-02-20 a las 21.10.17

The link of my github account on this code is at the end.

 

For the second exercise, we needed to create a program which can tell you the value of a location in the fibonacci’s serie.
Honestly at the beginning I was so frustrated because I have no idea how to do it. I look up to the formula but i was this one: fibonacci-sequence-formula, and I didn’t understand it. So my friend Miguel gave me a hand. Told to put those 4 integers to use them on my code. Finally with his help we could create this code and I worked. You should see my face at the moment.

Captura de pantalla 2016-02-20 a las 21.10.30

The link to my GitHub account is right here.
https://github.com/antonioangelm24/TC101/blob/master/Quiz%203%20_%202%20-%20Fibonacci

https://github.com/antonioangelm24/TC101/blob/master/Quiz%203_1

 

WSQ08 – on to the functions

This program should give you the same results as the WSQ03 but using function for each operation.

Captura de pantalla 2016-02-16 a las 8.59.42Captura de pantalla 2016-02-16 a las 8.59.47So basically, I write single functions, to the sum, product, difference, and division operations. Using void instead of int. And this was kind of quickly because I just copy the main code from de WSQ03, and then I started to editing what I needed.

Here’s the link to my GitHub.

WSQ08 – On To Functions


WSQ07- Sum of numbers

This program should give you the sum of a specific range, that you will provide to the computer. So if you type 3 & 9, the program should return the sum of 3+4+5+6+7+8+9.

So.. Captura de pantalla 2016-02-16 a las 8.37.19

First you need to call the two integers of the range, also the result.
I did one work like this when I was in computing remedial.
In this case y & x are the range and x the result.
You keep adding +1 every time until y = z, then you stop.

 

The link to my GitHub is here too..
https://github.com/antonioangelm24/TC101/blob/master/WSQ07