KOD KISMI:
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 Randomla_üretilen_sayılarla_işlemler
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Random rastgele = new Random();
private void button1_Click(object sender, EventArgs e)
{
for (int i = 0; i < 10; i++)
{
int sayi = rastgele.Next(0, 100);
listBox1.Items.Add(rastgele.Next(0, 100));
}
}
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
int[] sayilar = new int[listBox1.Items.Count];
double toplam = 0;
for (int i = 0; i < listBox1.Items.Count; i++)
{
sayilar[i] = Convert.ToInt32(listBox1.Items[i].ToString());
toplam += sayilar[i];
}
label4.Text = toplam.ToString();
}
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
int[] sayilar = new int[listBox1.Items.Count];
int carpim = 0;
for (int i = 0; i < listBox1.Items.Count; i++)
{
sayilar[i] = Convert.ToInt16(listBox1.Items[i].ToString());
carpim +=sayilar[i]* sayilar[i];
}
label3.Text = carpim.ToString();
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
YAPIM --> FURKAN ÇEBİ
Hiç yorum yok:
Yorum Gönder