Number 7!

I’ve been working on some other stuff for the past few days and didn’t pay attention to the work I’m supposed to be doing here, but now I’m back and let’s move forward. WSQ#07 is a Sum of numbers, but not x+y, it is the sum of all the numbers between x and y, it wasn’t that hard, so, I’m feeling ready for the exam.


Here goes the code in Atom:

wsq07 code

And the program:

wsq07 exe

And as the program says: Have a nice day!

“If you know the enemy and know yourself you need not fear the results of a hundred battles” – Sun Tzu

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..


Sum of numbers

This program is about asking a range of integers and then it gives you the sum of the numbers in that range.

For example, the sum from 3 to 6 would be 3 + 4 + 5 + 6 = 18.


Even it was not hard at all, I was having trouble because I had little mistakes that I didn´t noticed at first.

Then the program was working, but the sum of the numbers was wrong so I changed again and finally it work correctly.

This program was about using a simple do – while so it can keep making sum until de first number its equal to the second one.

Here you can see my code: Sum of numbers.

And this is a picture of my program working. Notice that at first you can see  the wrong sum of the numbers that I changed at the end. sumofnumberscygwin.jpg

WSQ07 – Funnier with numbahs

The pun in the name, yes I know, I had to do it, get over it.

So. Today’s practice obviously includes numbers… and also loops. If you’re keeping up with my posts, you should know about while loops, but now we’re deep into for loops. What are these? Well, if while loops go on until their condition isn’t met, for loops are kind of the opposite, they go on until their conditions are met… for example, if I want to print each letter in a string I’d do something like : 


for letter in “string” :

print letter


And the output would be :









Now that we’re all about for loops, let’s go on with the show. 

Our code should ask for two values, integers, and the output should be the sum of all the numbers between those two values, including them. For example, for the input 2 and 8, the code should make the operation 2 + 3 + 4 + 5 + 6 + 7 + 8 and return 35. 

That’s simple, right? The first thing that came to my mind was a scene about the School of rock movie, the second was this :


Editor :

Screen Shot 2016-02-13 at 4.35.24 PM

Terminal :

Screen Shot 2016-02-13 at 4.37.19 PM


What range does is exactly that, make a for loop run a certain number of times, the loop will run the number of times equivalent to the number of values between the first and the second input, and the value of i will be each and every one of those numbers, so our code easy does it, right?

So we’re done! Ok, cool.









But wait! What if the user inputs integers in an inverted order? for example,

Screen Shot 2016-02-13 at 4.40.18 PM
Screen Shot 2016-02-14 at 3.15.43 PM
Screen Shot 2016-02-14 at 3.39.29 PM
Screen Shot 2016-02-14 at 3.05.38 PM
Screen Shot 2016-02-14 at 3.54.48 PM

Continue reading “WSQ07 – Funnier with numbahs”

Sum of numbers WSQ07

Hello my friends, today we are going to do a task that is very similar to the last ones, but a little more difficult, we are going to write a program that ask the user for a range of integer numbers and then prints the sum of the numbers in that range (inclusive).

We can use a formula but thats not the way that we are going to do it, first we have to decelerate variants, and the use “while” and “if”. Here are some grateful videos for your enjoyment.


And as always, the link for my code in GitHub and some evidence

Captura de pantalla 2016-02-12 a las 8.42.59 p.m..png



#WSQ07 – Sum of numbers.


Hello people! It’s time of partial exams so I was so bussy studying but here I am with new posts of programming 😀. Well, on this new program we have to ask for a range of integers and then prints the sum of the numbers in that range. For example if we use 9 and 15, the program may do the next addition: 0+9+10+11+12+13+14+15=x. How do we do that?

First, we have to ask for the two numbers to have the range of numbers to make the addition. Then we use a loop (DO-WHILE) to add the following numbers with a counter (++) while the counter be different of the bigger number.

So, here the screenshot of my C++ code.


As you can see, the loop do-while help us to make the increase in the lower number until we reach the highest bound.

And the program running:


Dont forget to see my codes on GitHub, click here to see them.

Einstein can Add

Photograph Credit

Einstein has nothing to do with the program 🙂, I just thought it would catch your attention. As always look at this pages for reference:

And here is my code, simple and complex respectively:



In my tutorial at the bottom I show you how to do this program with loops but there is another way of doing it. That is Recursion. Here is Bucky’s tutorial on how to do that. By the way, you should go and check out his other tutorial as well.

Made by Orlando Lara


Este es un programa para calcular la suma de los que estén dentro de un rango especifico, que quiere decir esto?, pues que debes de pedir al usuario el primer numero que quieres que se sume, por ejemplo yo lo llame “rangoi” y supongamos que le das el valor de 1, entonces dices hasta que numero quieres que sume y yo lo llame “rangof” y le di el valor de por ejemplo 5, que quiere decir esto?, la operación que queremos que se haga es; como en el ejemplo el primer valor fue 1, desde ahí partirá así: 1+2+3+4+5=15. La pregunta aquí es, porque hasta el 5? porque a eso se refiere el rangof, que es el segundo numero que te pide el programa, para saber hasta donde sumar. Sabemos que no es tan sencillo como solo pedir al usuario dos numeros y que se sumen, pues de ser así haría esto: 1+5=6 y eso está mal. no es lo que queremos, queremos que nos sume todos los números que haya dentro de ese rango, enteros, por supuesto. *Cómo hacemos que eso sucede? Se debe usar un ciclo for, no se debe utilizar un while o do-while porque el ciclo for se usa, cuando sabes cuantas veces se va a repetir el ciclo, lo cual es el caso, pues ya estas dando desde donde empieza hasta donde termina, entonces sabes cuantas veces se hará el ciclo . En una función for siempre debes tener tres cosas importantes: 1) tu contador (puedes representarla con la variable que tu quieras, y este contador sera igual a desde donde empieza el ciclo, que en este caso es la variable rangoi, que se refiere al primer numero de donde partirá) . 2) Debes tener el contador especificando hasta donde el ciclo se seguirá repitiendo.



Sum of Numbers

In this program the user had to give to numbers and it has to make the sum of the number that are in range to give us a integrer number.

I check a video on youtube, here is the link to that video hope it works.

Here we have the Atom page where I edit my program


And here I have my Cygwin to see how the program works, I make a mistake option if the user enters a bigger number in the first number. If you make this mistake you have to do it again.


Here I have my code on Github