Advertisement
idndn

Untitled

Mar 29th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.24 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.Windows.Forms;
  9.  
  10. namespace multiplication_table2
  11. {
  12.     public partial class Form1 : Form
  13.     {
  14.         public Form1()
  15.         {
  16.             InitializeComponent();
  17.         }
  18.  
  19.         private void button1_Click(object sender, EventArgs e)
  20.         {
  21.             int iTemp = 0;
  22.             int jTemp = 0;
  23.             string gap = "";
  24.             string line = "    "; //3 gaps
  25.             for (int i = 0; i < numericUpDown1.Value; i++)
  26.             {
  27.                 iTemp = i;
  28.                 iTemp++;
  29.                 line = line + iTemp + "   ";
  30.                 iTemp = 0;
  31.             }
  32.             label2.Text = line + "\n";
  33.  
  34.             for (int i = 0; i < numericUpDown1.Value; i++)
  35.             {
  36.                 iTemp = i;
  37.                 iTemp++;
  38.                 line = iTemp + "   ";
  39.                 for (int j = 0; j < numericUpDown1.Value; j++)
  40.                 {
  41.                     jTemp = j;
  42.                     jTemp++;
  43.                     if (jTemp * iTemp > 9)
  44.                     {
  45.                         gap = "";
  46.                     } else
  47.                     {
  48.                         gap = " ";
  49.                     }
  50.                     line = line + jTemp * iTemp + "  " + gap;
  51.                 }
  52.                 label2.Text = label2.Text + line + "\n";
  53.             }
  54.         }
  55.  
  56.         private void button2_Click(object sender, EventArgs e)
  57.         {
  58.             label2.Text = "sjkdg;lkjsadjg\n sdfj\n";
  59.         }
  60.  
  61.         private void label1_Click(object sender, EventArgs e)
  62.         {
  63.  
  64.         }
  65.     }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement