Fun with Numbers

This was a little bit difficult than Hello World because in this code I had to search in differents blogs and in Youtube about how to do operations like sum, rest, division and multiplication. I searched in Google and I found this blog http://programa-c.blogspot.mx/2010/04/codigos-c-suma-dos-numeros-enteros.html which help me a lot, becuase I used it like the base an then I added product and division.

#include <iostream>
#include <stdlib.h>
using namespace std;

int main(){

int a,b,suma,resta,producto,division=0;

cout<<«\n ingrese numero a:»;

cin>>a;

cout<<«\n ingrese numero b:»;

cin>>b;

suma=a+b;
resta=a-b;
producto=a*b;
division=a/b;

cout<<«\n la suma de «<<a<<«+»<<b<<» es:»<<suma;
cout<<«\n la resta de «<<a<<«-«<<b<<» es:»<<resta;
cout<<«\n el producto de «<<a<<«*»<<b<<» es:»<<producto;
cout<<«\n la division de «<<a<<«/»<<b<<» es:»<<division;

return 0;

 

}

Links

Programa C, Suma de dos números enteros:

http://programa-c.blogspot.mx/2010/04/codigos-c-suma-dos-numeros-enteros.html

Deja un comentario