Faktöriyel Hesapla - Microsoft Excel


Verilen sayı ile ilgili faktöriyel hesabı yapan VBA kodudur.

Kod


Option Explicit

Sub FaktoriyelHesapla()
    Dim i               As Long
    Dim sayi            As Long
    Dim faktoriyelSonuc As Double
    
    faktoriyelSonuc = 1
    sayi = InputBox("Faktöriyeli hesaplanacak sayıyı giriniz:")
    
    For i = 1 To sayi
        faktoriyelSonuc = faktoriyelSonuc * i
    Next
    
    MsgBox sayi & "! = " & faktoriyelSonuc
End Sub

Etiketler
microsoft excel microsoft excel vba microsoft excel vba matematik işlemleri