my code stock.com

LexXxE

contador de monedas y billetes
by LexXxE

Snippet options

Download: Download snippet as contador-de-monedas-y-billetes.cpp.
Copy snippet: For this you need a free my code stock.com account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

#include <iostream>
using namespace std;

int main()
{
    int monto;
    int b_20k;
    int b_10k;
    int b_5k;
    int b_2k;
    int b_1k;
    int m_500;
    int m_100;
    int m_50;
    int m_10;
    int m_5;
    int m_1;
    cout<<"monto: $";
    cin>>monto;
    b_20k= monto/20000;
    b_10k=(monto-b_20k*20000)/10000;
    b_5k=(monto-b_20k*20000-b_10k*10000)/5000;
    b_2k=(monto-b_20k*20000-b_10k*10000-b_5k*5000)/2000;
    b_1k=(monto-b_20k*20000-b_10k*10000-b_5k*5000-b_2k*2000)/1000;
    m_500=(monto-b_20k*20000-b_10k*10000-b_5k*5000-b_2k*2000-b_1k*1000)/500;
    m_100=(monto-b_20k*20000-b_10k*10000-b_5k*5000-b_2k*2000-b_1k*1000-m_500*500)/100;
    m_50=(monto-b_20k*20000-b_10k*10000-b_5k*5000-b_2k*2000-b_1k*1000-m_500*500-m_100*100)/50;
    m_10=(monto-b_20k*20000-b_10k*10000-b_5k*5000-b_2k*2000-b_1k*1000-m_500*500-m_100*100-m_50*50)/10;
    m_5=(monto-b_20k*20000-b_10k*10000-b_5k*5000-b_2k*2000-b_1k*1000-m_500*500-m_100*100-m_50*50-m_10*10)/5;
    m_1=(monto-b_20k*20000-b_10k*10000-b_5k*5000-b_2k*2000-b_1k*1000-m_500*500-m_100*100-m_50*50-m_10*10-m_5*5)/1;
    cout<<b_20k<<" billetes de $20000 "<< endl;
    cout<<b_10k<<" billetes de $10000 "<<endl;
    cout<<b_5k<<" billetes de $5000 "<< endl;
    cout<<b_2k<<" billetes de $2000 "<< endl;
    cout<<b_1k<<" billetes de $1000"<<endl;
    cout<<m_500<<" monedas de $500"<< endl;
    cout<<m_100<<" monedas de $100"<< endl;
    cout<<m_50<<" monedas de $50"<< endl;
    cout<<m_10<<" monedas de $10"<< endl;
    cout<<m_5<<" monedas de $5"<< endl;
    cout<<m_1<<" monedas de $1"<< endl;
    system("pause");
    return 0;
}

Create a free my code stock.com account now.

my code stok.com is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.