C# EBOB BULMA PROGRAMI - C # GCD FINDING PROGRAM
C# EBOB BULMA PROGRAMI -
C # GCD FINDING PROGRAM
EBOBBul
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace EBOBBul
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
button1.Text = "EBOB BUL";
}
private void button1_Click(object sender, EventArgs e)
{
int sayi1 = Convert.ToInt32(textBox1.Text);
int sayi2 = Convert.ToInt32(textBox2.Text);
int ebob = ebobal(sayi1, sayi2);
textBox3.Text = ebob.ToString();
}
private int ebobal(int sayi1,int sayi2)
{
int ebob = 1, bolen = 2;
while(sayi1>1||sayi2>1)
{
if ((sayi1 % bolen == 0) && (sayi2 % bolen == 0))
ebob *= bolen;
if (sayi1 % bolen == 0)
sayi1 /= bolen;
if (sayi2 % bolen == 0)
sayi2 /= bolen;
if ((sayi1 % bolen != 0) && (sayi2 % bolen != 0))
bolen++;
}
return ebob;
}
}
}
C# EBOB BULMA PROGRAMI - C # GCD FINDING PROGRAM
Reviewed by MARS
on
Ekim 31, 2017
Rating:

Hiç yorum yok: