Using Using Using Using Using Using Using Namespace Public Partial Class Public

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

using System;

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Q2.Rolling_dice
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Class1 obj = new Class1();
private void button1_Click(object sender, EventArgs e)
{
obj.combination();
for (int a = 0; a < 36; a++)
{
listBox1.Items.Add( obj.combinations[a]);
}
}
}

using System;
using System.Collections.Generic;
using System.Text;

namespace Q2.Rolling_dice
{
class Class1
{
public string[] combinations = new string[36];
protected int index;
public void combination()
{
for (int a = 1; a <= 6; a++)
{
for (int b = 1; b <= 6; b++)
{
combinations[index] = a.ToString() + " " + b.ToString();
index++;
}
}
}
}
}

You might also like