" Umut, hiç görmeyen birine gökkuşağını anlatmak kadar zor ve imkansız... "

Categories

-

Vb.Net Uygulamalari 1 - c

Vb.net uygulamalarindan dört islem uygulamasi, ardisik sayilarin toplami uygulamasi, mekanik sayaç uygulamasi, asal sayi testi uygulamasini ve Pi sayisinin yaklasik hesabi uygulamasini visual studio programi kullanarak olusturacagiz.

11. Uygulamamiz



Kodlarmiz;

Public Class Form1
    Dim s1, s2 As Integer
    Dim s As Double

    Private Sub txtsayi1_TextChanged(sender As Object, e As EventArgs) Handles txtsayi1.TextChanged
        txtsayi2.Enabled = True
    End Sub

    Private Sub btnhesapla_Click(sender As Object, e As EventArgs) Handles btnhesapla.Click

        If IsNumeric(txtsayi1.Text) = True And IsNumeric(txtsayi2.Text) Then
            s1 = txtsayi1.Text
            s2 = txtsayi2.Text
            If Radiotopla.Checked = True Then
                s = s1 + s2
            ElseIf Radiocikar.Checked = True Then
                s = s1 - s2
            ElseIf Radioçarp.Checked = True Then
                s = s1 * s2
            ElseIf Radioböl.Checked = True And s2 <> 0 Then ' Sifira bölme yapmasini kontrol ediyoruz.
                s = s1 / s2
            End If

            txtsonuc.Text = s
        Else
            MessageBox.Show("Lütfen sayi girisi yapiniz", "Hata olustu", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1)
            txtsayi1.Clear()
            txtsayi2.Clear()
        End If
    End Sub
End Class

12. Uygulamamiz



Kodlarimiz;

Public Class Form1
    Dim sayac, toplam As Integer
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        toplam = 0
        sayac = 1
        For sayac = txtsayibas.Text To txtsayibitis.Text
            toplam = toplam + sayac
        Next
        MsgBox(toplam)
    End Sub
End Class

13. Uygulamamiz



Kodlarimiz;

Public Class Form1
    Private Sub btnbaslat_Click(sender As Object, e As EventArgs) Handles btnbaslat.Click
        For basamak1 = 0 To 9
            Label1.Text = basamak1
            For bekle = 0 To 10000000
            Next
            Label1.Refresh()

            For basamak2 = 0 To 9
                Label2.Text = basamak2
                For bekle = 0 To 10000000
                Next
                Label2.Refresh()

                For basamak3 = 0 To 9
                    Label3.Text = basamak3
                    For bekle = 0 To 10000000
                    Next
                    Label3.Refresh()
                Next
            Next
        Next
    End Sub
End Class

14. Uygulamamiz

Kodlarimiz;

Public Class Form1
    Dim asalmi As Boolean = True
    Dim sayi As UInt64 ' En büyük tam sayi türü
    Dim deger As UInt64 = 0
    Private Sub btnasalmi_Click(sender As Object, e As EventArgs) Handles btnasalmi.Click
        deger = txtsayi.Text

        If IsNumeric(txtsayi.Text) = False Then
            MessageBox.Show("Lütfen girilen degeri kontrol ediniz !", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)
        Else

            If deger = 2 Then
                asalmi = True
            Else
                For sayi = 3 To deger - 1  ' Sayinin yarisina kadar bölen arastirilacak
                    If deger Mod sayi = 0 Then
                        asalmi = False
                        ListBox1.Items.Add(sayi)
                        Exit For ' Daha fazla arastirmaya gerek yok
                    End If
                Next
            End If

            If asalmi = True Then ' Demekki yukaridaki hiç bir kosula girmemis.
                MessageBox.Show(txtsayi.Text & " " & "Sayisi asaldir !", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)
            Else
                MessageBox.Show(deger & " " & "sayisi asal degildir." & sayi & " " & "sayisi bu sayiyi böler !", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1)
            End If

        End If
    End Sub
End Class

15. Uygulamamiz



Kodlarimiz;

Public Class Form1
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim toplam As Double = 1
        Dim k, i, faktor, faktor1 As Long

        If txtyaklasim.Text.Trim <> "" Then
            If IsNumeric(txtyaklasim.Text) = True Then
                If txtyaklasim.Text > 0 And txtyaklasim.Text < 10 Then
                    For k = 1 To txtyaklasim.Text
                        ' k faktöriyel hesaplaniyor
                        faktor = 1
                        For i = 1 To k
                            faktor = faktor * i
                        Next
                        ' 2k+1 faktoriyel hesaplaniyor
                        faktor1 = 1
                        For i = 1 To 2 * k + 1
                            faktor1 = faktor1 * i
                        Next
                        ' Toplam hesaplaniyor
                        toplam = toplam + ((2 ^ k) * (faktor ^ 2)) / faktor1
                    Next
                    lblsonuc.Text = 2 * toplam
                Else
                    MessageBox.Show("Yaklasim sayisi 1 ile 9 arasinda olmalidir !", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)
                    txtyaklasim.Clear()
                End If
            Else
                MessageBox.Show("Lütfen sayisal bir deger giriniz !", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)
                txtyaklasim.Clear()
            End If
        Else

            MessageBox.Show("Ilgili alana veri girisi yapiniz !", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)
        End If
    End Sub
End Class

Uygulamalari buradan indirebilirsiniz !

  • 0
  • 760
  • 0

- BUNLARIDA GÖZDEN GEÇİREBİLİRSİNİZ -

HENÜZ YORUM YAPILMAMIŞ !

Yorum yazın

HAKKIMDA

KONULARI TAKİP EDİN

SOSYAL AĞLAR

  • Mesajınızı Gonderin