Jump to content
×
×
  • Create New...

Lorem Ipsum is simply dummy text

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s

Test Test

Lorem Ipsum is simply dummy text

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s

Test Test

Lorem Ipsum is simply dummy text

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s

Test Test

Lorem Ipsum is simply dummy text

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s

Test Test

Lorem Ipsum is simply dummy text

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s

Test Test

  • Bu Alana Reklam Verebilirsiniz
    Bu Alana Reklam Verebilirsiniz

Girilen İki Sayı Arasındaki Asalları Bulan Program | ASP.NET

Rate this topic


serverIR

Recommended Posts

Girilen İki Sayı Arasındaki Asalları Bulan Program | ASP.NET
  • Members

Bu örnekte ASP.NET ile kullanıcının girdiği iki sayı arasındaki asal sayıları bularak listeleme işlemi gerçekleştireceğiz.

 

Örneğimizde kullanıcıdan sayıları almak için iki adet Textbox kontrolü ve bulunan asal sayıları listelemek için bir adet listBox kontrolü ekleyeceğiz.

Listeleme işlemini web formumuza eklediğimiz Button kontrolü ile gerçekleştireceğiz.

Örneğimize ait tasarım kısmı aşağıdaki gibi olacaktır.

 

asp-net-asal-sayi-1.webp

 

Form tasarımı ve button kontrolüne ait kodlar ile ekran çıktısı ise aşağıdaki gibi oluşacaktır.

 

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication3.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style>
        body{
            color:aliceblue;
        }
        table{
            background-color:#ff6a00;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <table border="0" style="width: 350px" class="tablo">
            <tr>
                <td  colspan="2">ASAL SAYILARI BULMA</td>
            </tr>
            <tr>
                <td class="auto-style4">İlk Sayı</td>
                <td aria-autocomplete="inline" class="auto-style11">
                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="auto-style4">Son Sayı</td>
                <td aria-autocomplete="inline" class="auto-style11">
                    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="auto-style4">&nbsp;</td>
                <td aria-autocomplete="inline" class="auto-style9">
                    <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Asal Olanları Bul" />
                </td>
            </tr>
            <tr>
                <td class="auto-style4">İki Sayı Arasında Bulunan Asal Sayılar</td>
                <td aria-autocomplete="inline" class="auto-style9">
                    <asp:ListBox ID="ListBox1" runat="server" Height="186px" Width="149px"></asp:ListBox>
                    <br />
                </td>
            </tr>
            <tr>
                <td class="auto-style4" colspan="2">
                    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
                </td>
            </tr>
        </table>
        </div>
    </form>
</body>
</html>

 

.cs dosyamız:

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
namespace WebApplication3
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
 
        }
 
        protected void Button1_Click(object sender, EventArgs e)
        {
            ListBox1.Items.Clear();
            int ilksayi = Convert.ToInt32(TextBox1.Text);
            int sonsayi = Convert.ToInt32(TextBox2.Text);
 
            int sayi = ilksayi;
            bool durum = true;
            while (sayi < sonsayi)
            {
                sayi++;
                for (int i = 2; i < sayi; i++)
                {
                    if (sayi % i == 0)
                    {
                        durum = false;
                    }
                }
                if (durum == true && sayi != 1)
                {
                    ListBox1.Items.Add(sayi.ToString());
                }
                durum = true;
            }
 
            //www.yazilimkodlama.com
            Label1.Text = "İki Sayı Arasında " + ListBox1.Items.Count.ToString() + " Tane Asal Sayı Var";
        }
    }
}

 

Ekran Çıktısı:

 

asp-net-asal-sayi-2-1.webp

Edited by serverIR

----------------------------------------------------------------------------

Link to comment
https://weblep.com/topic/200-girilen-i%CC%87ki-say%C4%B1-aras%C4%B1ndaki-asallar%C4%B1-bulan-program-aspnet/
Share on other sites


Konu Altı Reklam 1
Konu Altı Reklam 2
  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted Images

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...