1-) C# - ForDonguOrnekleri(ders18)
using System;
using System.Windows.Forms;
namespace WindowsFormsApp7
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//int a = 0;
// a = a + 1; // ++a; demek a = a + 1; demektir
//int b = a++;
//MessageBox.Show(b.ToString());
//MessageBox.Show((a++).ToString());
//MessageBox.Show(a.ToString());
//int b = a++;
//MessageBox.Show(b.ToString());
/* 1 den 1000 e kadar ve dahil çift sayıları listboxa yazdırma*/
//for (int i = 2; i <= 1000; i=i+2)
//{
// listBox1.Items.Add(i.ToString());
//}
/* 1 den 1000 e kadar ve dahil tek sayıları listboxa yazdırma*/
//for (int i = 1; i <= 1000; i = i + 2)
//{
//listBox1.Items.Add(i.ToString());
// }
for (int i = 10; i <= 1000; i = i + 10)
{
listBox1.Items.Add(i.ToString());
}
}
}
}

namespace ForDonguOrnekleri
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int i = 0;
int toplam = 0;
private void button1_Click(object sender, EventArgs e)
{
for (i = 0; i < 6; i++)
{
toplam = toplam + i;
listBox1.Items.Add(i);
listBox2.Items.Add(toplam);
}

FaktoriyelOrnek
namespace FaktoriyelOrnek
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int i = 1;
int faktoriyel = 1;
private void button1_Click(object sender, EventArgs e)
{
for (i = 1; i <= 7; i++)
{
faktoriyel = faktoriyel * i;
listBox1.Items.Add(faktoriyel);
label1.Text = faktoriyel.ToString();
}
}
}
}
