C# asal sayı bulma

Ana sayfa Forumlar PROGRAMLAMA C# C# asal sayı bulma

  • Bu konu 1 yanıt içerir, 2 izleyen vardır ve en son 12 yıl önce özgür tarafından güncellenmiştir.
2 yazı görüntüleniyor - 1 ile 2 arası (toplam 2)
  • Yazar
    Yazılar
  • #12390

    using System;

    using System.Collections.Generic;

    using System.ComponentModel;

    using System.Data;

    using System.Drawing;

    using System.Text;

    using System.Windows.Forms;

    namespace WindowsApplication8

    {

    public partial class Form1 : Form

    {

    public Form1()

    {

    InitializeComponent();

    }

    private void button1_Click(object sender, EventArgs e)

    {

    int i, a, b, top, j;

    a = Convert.ToInt32(textBox1.Text);

    b = Convert.ToInt32(textBox2.Text);

    for (i = a; i <= b; i++) { top = 0; for (j = 1; j <= i; j++) if (i % j == 0) top = top + 1; if (top == 2) listBox1.Items.Add(Convert.ToString(i)); } } } }

    #12400
    özgür
    İzleyici

    teşekkürler

2 yazı görüntüleniyor - 1 ile 2 arası (toplam 2)
  • Bu konuyu yanıtlamak için giriş yapmış olmalısınız.
Bana Ders Anlat © 2008-2022