C# The secret to number 8

Posted: October 3, 2014 in Interesting box
Tags: ,

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;
using System.Collections;

namespace WindowsFormsApplication14
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
int [] Dizi = new int[9];
Dizi[0] = 1;
Dizi[1] = 12;
Dizi[2] = 123;
Dizi[3] = 1234;
Dizi[4] = 12345;
Dizi[5] = 123456;
Dizi[6] = 1234567;
Dizi[7] = 12345678;
Dizi[8] = 123456789;

listBox1.Items.Add(“The secret to number 8”);

for (int i =1; i <10; i++)
{

int a,b;

b = 8;
a = Dizi[i – 1] * b + i;

listBox1.Items.Add(Dizi[i-1] + " * " + b +" + " + i +" :: "+ a.ToString());

}

}

}
}

29

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s