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.

sumofnumbersatom.jpg

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

Un comentario

  1. MajoDavila · febrero 16, 2016

    No sé que lenguaje de programación es, (yo llevo python) pero en la parte de «num1=num1+1» lo puedes escribir como num1+=1 siempre que se ponga un «+», «-» ,»*» ,después del nombre de esa variable y en seguida el «=» (num1*=x ó num1+=1 ó num1-=1) lo que hará será incluirse en la operacion y sumarle, restarle, multiplicarle lo que hayas puesto después del signo igual. Probablemente sea C? yo lleve C#, supongo que ha de ser algo similar, yo creo que aplica para cualquier lenguaje (espero) (:

    Me gusta

Deja un comentario