C# Form Mükemmel Sayı Uygulaması
C Sharp Mükemmel Sayı uygulaması. C# form da textbox dan girilen değerin tam sayı olup olmadığını bulma. Eğer girilen değer tam sayı ise bu sayının mükemmel sayı olup olmadığını bulma. Eğer sayı mükemmel sayı ise messagebox kullanarak kullanıcıya girilen sayı mükemmel sayıdır uyarısı verdirme. Eğer sayı mükemmel sayı değilse girilen sayı mükemmel sayı değildir uyarısı verdirme. Bir sayının pozitif tam bölenlerinin toplamı kendisine eşit ise o sayı mükemmel sayıdır.
Programın Visual C# Form kodu:
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 Mükemmel_Sayı_Bulma { public partial class Form1 : Form { public Form1() { InitializeComponent(); } //www.bilisimkonulari.com int bolen; int sonucToplam = 0; int girilenSayi = 0; private void Form1_Load(object sender, EventArgs e) { //www.bilisimkonulari.com } private void button1_Click(object sender, EventArgs e) { sonucToplam = 0; try { girilenSayi = Convert.ToInt32(textBox1.Text); if (girilenSayi == 0) { MessageBox.Show("Girilen Sayı Mükemmel Sayı Değildir", "BİLGİ", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } catch { MessageBox.Show("Lütfen Tam Sayı Giriniz.", "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } for (bolen = 1; bolen < girilenSayi; bolen++) { if (girilenSayi % bolen == 0) { //www.bilisimkonulari.com sonucToplam += bolen; } } if (girilenSayi == sonucToplam) { MessageBox.Show("Girilen Sayı Mükemmel Sayıdır.", "BİLGİ", MessageBoxButtons.OK, MessageBoxIcon.Information); } else //www.bilisimkonulari.com { MessageBox.Show("Girilen Sayı Mükemmel Sayı Değildir", "BİLGİ", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }
Bu Yazıya Tepkin Nedir?
+1
+1
+1
1
+1
+1
+1
+1
<< Önceki Yazı
Sonraki Yazı >>
c# basit örnekler, c# form application, c# form mükemmel sayı, c# form örnekleri for döngüsü, c# mükemmel sayı, c# örnekleri console, c# örnekleri pdf, c# windows form application örnekleri pdf, c# windows form proje örnekleri, mükemmel sayı, mükemmel sayı bulma, mükemmel sayı c#, mükemmel sayı c# form application, nesne tabanlı programlama form örnekleri
Böyle paylaşımlar için teşekkür ederiz.