Advertisement
Guest User

Untitled

a guest
Aug 18th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace WindowsFormsApplication3
  12. {
  13. public partial class Form1 : Form
  14. {
  15. public Form1()
  16. {
  17. InitializeComponent();
  18. }
  19.  
  20.  
  21. private void button1_Click(object sender, EventArgs e)
  22. {
  23.  
  24. }
  25.  
  26. private void label3_Click(object sender, EventArgs e)
  27. {
  28.  
  29. }
  30.  
  31. private void button2_Click(object sender, EventArgs e)
  32. {
  33. int angka;
  34. angka = Convert.ToInt32(textBox2.Text);
  35. int hasil = angka;
  36. for (int counter = angka-1; counter > 0; counter--)
  37. {
  38. int hasil1 = hasil;
  39. hasil = hasil * counter;
  40. textBox3.AppendText(Convert.ToString(hasil1 + "*" + counter + "=" + hasil + Environment.NewLine));
  41.  
  42. }
  43. textBox3.AppendText(Convert.ToString(Environment.NewLine));
  44. textBox3.AppendText(Convert.ToString("Hasil faktorial dari" + angka + "adalah" + hasil));
  45. }
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement