WSQ01 FUN WITH NUMBERS

What to do:

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

  • The sum of the two numbers.
  • 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

Progress:

First we name the variables so that we do not mark the program’s error, then we start to create the arithmetic operations with the variables “num1” and “num2”, and in the end we print in the screen.

captura-de-pantalla-2017-01-30-a-las-09-10-26captura-de-pantalla-2017-01-30-a-las-09-10-12

#include <iostream>
using namespace std;
int main() {
int num1,num2,suma,resta,multiplicacion,division,residuo;
std::cout << “este programa pide dos numeros y hace operaciones con ellos” << ‘\n’;
std::cout << “dame el primer numero” << ‘\n’;
std::cin >> num1;
std::cout << “dame el segundo numero” << ‘\n’;
std::cin >> num2;
suma=num1+num2;
resta=num1-num2;
multiplicacion=num1*num2;
division=num1/num2;
residuo=num1%num2;
std::cout << “la suma de los numeros es:” <<suma<< ‘\n’;
std::cout << “la resta de los numeros es:” <<resta<< ‘\n’;
std::cout << “la multiplicacion de los numeros es:” <<multiplicacion<< ‘\n’;
std::cout << “el resultado de l division es:” <<division<< ‘\n’;
std::cout << “el residuo de la division es:” <<residuo<< ‘\n’;
return 0;
};

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s