Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace Caixa
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void pictureBox1_Click(object sender, EventArgs e)
- {
- }
- private void pictureBox2_Click(object sender, EventArgs e)
- {
- }
- private void pictureBox4_Click(object sender, EventArgs e)
- {
- }
- private void pictureBox5_Click(object sender, EventArgs e)
- {
- }
- private void pictureBox6_Click(object sender, EventArgs e)
- {
- }
- private void pictureBox8_Click(object sender, EventArgs e)
- {
- }
- private void label1_Click(object sender, EventArgs e)
- {
- }
- //Botâo Calcular
- private void button1_Click(object sender, EventArgs e)
- {
- int num, soma = 0;
- int contNota100 = 0, contNota50 = 0, contNota20 = 0, contNota10 = 0, contNota5 = 0, contNota2 = 0;
- num = int.Parse(textBox1.Text);
- while (num != soma)
- {
- if ((num - soma) >= 100)
- {
- soma += 100;
- contNota100++;
- }
- if ((num - soma) >= 50)
- {
- soma += 50;
- contNota50++;
- }
- if ((num - soma) >= 20)
- {
- soma += 20;
- contNota20++;
- }
- if ((num - soma) >= 10)
- {
- soma += 10;
- contNota10++;
- }
- if ((num - soma) >= 5)
- {
- soma += 5;
- contNota5++;
- }
- if ((num - soma) >= 2)
- {
- soma += 2;
- contNota2++;
- }
- }
- if (contNota100 > 0)
- {
- label7.Text += contNota100.ToString();
- }
- if (contNota50 > 0)
- {
- label6.Text += contNota50.ToString();
- }
- if (contNota20 > 0)
- {
- label5.Text += contNota20.ToString();
- }
- if (contNota10 > 0)
- {
- label4.Text += contNota10.ToString();
- }
- if (contNota5 > 0)
- {
- label3.Text += contNota5.ToString();
- }
- if (contNota2 > 0)
- {
- label2.Text += contNota2.ToString();
- }
- }
- private void textBox1_TextChanged(object sender, EventArgs e)
- {
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- }
- private void label3_Click(object sender, EventArgs e)
- {
- }
- private void label1_Click_1(object sender, EventArgs e)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement