5 Aralık 2013 Perşembe

C Sharp Uygulamalar Mükemmel Sayı Hesaplama 100 ile 999 arasında



KONU : C Sharp Uygulamalar - C Sharp ( C# ) form da 100 ile 999 arasındaki mükemmel sayıları hesaplama.
ETİKETLER: c sharp sayılar - c sharp mükemmel sayılar - c sharp for döngüsü - c sharp listbox kontrolü.





UYGULAMAYI İNDİR



using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace mükemmel_sayılar
{
 /// 
 /// Summary description for Form1.
 /// 
 public class Form1 : System.Windows.Forms.Form
 {
  private System.Windows.Forms.Label label1;
  private System.Windows.Forms.Button button1;
  private System.Windows.Forms.ListBox listBox1;
  /// 
  /// Required designer variable.
  /// 
  private System.ComponentModel.Container components = null;

  public Form1()
  {
   //
   // Required for Windows Form Designer support
   //
   InitializeComponent();

   //
   // TODO: Add any constructor code after InitializeComponent call
   //
  }

  /// 
  /// Clean up any resources being used.
  /// 
  protected override void Dispose( bool disposing )
  {
   if( disposing )
   {
    if (components != null) 
    {
     components.Dispose();
    }
   }
   base.Dispose( disposing );
  }

  #region Windows Form Designer generated code
  /// 
  /// Required method for Designer support - do not modify
  /// the contents of this method with the code editor.
  /// 
  private void InitializeComponent()
  {
            this.label1 = new System.Windows.Forms.Label();
            this.button1 = new System.Windows.Forms.Button();
            this.listBox1 = new System.Windows.Forms.ListBox();
            this.SuspendLayout();
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Font = new System.Drawing.Font("Comic Sans MS", 12F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Underline))), System.Drawing.GraphicsUnit.Point, ((byte)(162)));
            this.label1.ForeColor = System.Drawing.Color.Maroon;
            this.label1.Location = new System.Drawing.Point(40, 16);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(237, 23);
            this.label1.TabIndex = 0;
            this.label1.Text = "Mükemmel Sayılar (100-999)";
            this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            // 
            // button1
            // 
            this.button1.BackColor = System.Drawing.Color.DeepPink;
            this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(162)));
            this.button1.ForeColor = System.Drawing.Color.Maroon;
            this.button1.Location = new System.Drawing.Point(16, 80);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(100, 132);
            this.button1.TabIndex = 3;
            this.button1.Text = "&Hesapla";
            this.button1.UseVisualStyleBackColor = false;
            this.button1.Click += new System.EventHandler(this.SayilariBul_Click);
            // 
            // listBox1
            // 
            this.listBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.listBox1.ForeColor = System.Drawing.Color.Maroon;
            this.listBox1.Location = new System.Drawing.Point(144, 80);
            this.listBox1.Name = "listBox1";
            this.listBox1.Size = new System.Drawing.Size(120, 132);
            this.listBox1.TabIndex = 4;
            // 
            // Form1
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.BackColor = System.Drawing.Color.Pink;
            this.ClientSize = new System.Drawing.Size(292, 266);
            this.Controls.Add(this.listBox1);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.label1);
            this.Name = "Form1";
            this.Text = "Mükemmel Sayıları Bul";
            this.ResumeLayout(false);
            this.PerformLayout();

  }
  #endregion

  /// 
  /// The main entry point for the application.
  /// 
  [STAThread]
  static void Main() 
  {
   Application.Run(new Form1());
  }

        private void SayilariBul_Click(object sender, System.EventArgs e)
        {
            int i, j, k;
            listBox1.Items.Clear();
            for (i = 1; i <= 9; i++)
            {
                for (j = 0; j <= 9; j++)
                {
                    for (k = 0; k <= 9; k++)
                    {
                        if (i + j + k == i * j * k)
                        {
                            listBox1.Items.Add(Convert.ToString(100 * i + 10 * j + k));
                        }
                    }
                }
            }
        }
 }
}

UYGULAMAYI İNDİR

Hiç yorum yok :

Yorum Gönderme