WSQ03 – Fun With Numbers

Ask the user for two integer values, then use those two values to calculate and show the following:

  • The difference of the two numbers.
  • The product of the two numbers.
  • The integer based division of the two numbers (so no decimal point). First divided by second.
  • The remainder of integer division of the two numbers.

Esta actividad se trata de realizar operaciones sencillas en el programa:

  • Resta
  • Multiplicación
  • División
  • Residuo de la división

Al momento de compilar este programa en Cygwin, se le preguntará al usuario por 2 números, al momento de seleccionar los 2 números, automáticamente se realizarán las operaciones ya mencionadas.

WSQ03 Atom

Debajo de int main(){, podemos observar varios int, es la abreviatura de integer, el cual significa que se nombran únicamente números enteros.

El usuario teclea algo gracias a cin>> y se guarda el en integer, en este caso, los integers d y a.

En donde dice Resta= d-a se declara que significa resta

En <<Resta se realiza la operación de la resta y te da el resultado

WSQ03 Cygwin

Estas notas se repiten para cada operación.

1024x1024sr

 

Wsq03/WSQ08

WSQ03These activities were about creating a program in which they calculate the division, sum, difference and the division remainder of two given numbers. It didn’t ask you to do it with function but I did anyways and that was asked in WSQ08. Everything is better if you use functions, for this you have to define your variables. To do this activity I had to check how to define a function, and now I know that you can define it with int, float, long, char.

#WSQ03 -Fun with numbers

numbersIn this assignment we had to create a programm that gave you the result of a sum, difference, product, and division from 2 numbers that you typed.

So first I wrote the usual stuff of

#include <iostream>

using namespace std;

Then I asked my friend Miguel how to put the values that you type into the “x” & “y”. He told me that we need to use cin >> so the programm knows that you will give the value of that integer.
After that, I was all like pure algebra.

Captura de pantalla 2016-02-15 a las 17.44.41At the end, do not forget to write return 0, because we are using an int main function, so it need to be return 0, at the end.

Here’s also the link to my GitHub.

https://github.com/antonioangelm24/TC101/blob/master/WSQ03.cpp

 

Fun with numbers WSQ03

Hello everyone!! This WSQ was simple, all about variables, the task is to ask the user for two integer numbers and calculate the following instructions:

  • The difference of the two numbers.
  • The product of the two numbers.
  • The integer based division of the two numbers (so no decimal point). First divided by second.
  • The remainder of integer division of the two numbers.

Captura de pantalla 2016-02-09 a las 1.46.10 p.m.

If you search in youtube or google, you can find various examples about this, most of them are in english, but are very helpful, I will leave some ones here.

This one is in English http://www.lynda.com/C-tutorials/Defining-variables/182674/366529-4.html.

As always, the link for my code in GitHub

 

WSQ03-Fahn with numbers

In today’s post we’re having fahn with numbers. We’re back on our elementary school days, learning how to sum, subtract, multiply, divide, get the division’s remainder, etc., we know our stuff when coming  to this, right? But what about python?… Well, doing arithmetical operations in python is much more easy, just learn how to ask for it and python will do it for you :

———————————————————————-

Screen Shot 2016-02-08 at 12.26.42 PM

———————————————————————-

There, we’re making a sum, right? but wait!

———————————————————————-

Screen Shot 2016-02-08 at 12.32.24 PM

———————————————————————-

Our program doesn’t do anything at all… Well, duh, we’re not printing anything, so this should do it :

———————————————————————-

Editor :

Screen Shot 2016-02-08 at 12.26.42 PM

Terminal :

Screen Shot 2016-02-08 at 12.40.11 PM.png

———————————————————————-

Yeah, there. 2 + 1 = 3, that’s right… right?… google cal… 2 + 1… yep, that’s 3. Great, so that’s how it’s done. now lets try all the other operations:

———————————————————————-

 

Playing with numbers

This WSQ was about asking the user for two integer numbers and then showing the difference, the product, the division and the remainder of integer division of those two numbers.

playingwithnumbersI didn´t have a lot of problems with this one. The structure was similar to other one I had made before but with more instructions on what the programs has to make. What I didn´t know was who to print the results of the instructions. So I look for it and found a blog that had a similar program, there I noticed that for printing you use also ” << ” after adding that my program worked correctly. If you want to see the blog click here.

You can see my program here: Playing with numbers.

playingwithnumbers2