using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace multip
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
decimal numps = numericUpDown1.Value;
for(int i=1; i<=numps; i++)
{
string doa, dab, xx, yy;
Random randNum1 = new Random();
int num1 = randNum1.Next(0, 101); // No larger than 108, no smaller than 1
Random randNum2 = new Random();
int num2 = randNum2.Next(0, 101);
int prod = num1 * num2;
string yak = textBox4.Text;
int usrans = Convert.ToInt32(yak);
if( prod == usrans)
{
doa = "Contratulations! The answer is";
xx = doa + prod;
textBox2.Text = xx;
}
else
{ dab = "Contratulations! The answer is";
yy = dab + prod;
textBox3.Text = yy;
}
}
}
}
}
No comments:
Post a Comment