26 Ekim 2016 Çarşamba

C ile Faktoriyel Hesabı - For-if Kullanımı

// Derste Yaptığımız C Programlarını buradan paylaşacağım :)


#include <stdio.h>
#include <stdlib.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char *argv[]) {

 // faktoriyel

 int sayi,i,faktoriyel=1;
 printf("faktoriyel alinacak saiyiyi girin : ");
 scanf("%d",&sayi);

 for(i=1;i<=sayi;i++)
 {
  faktoriyel=faktoriyel*i;
 }
    printf("Faktoriyel = %d ",faktoriyel);
    printf("i= %d",i);
   
return 0;
}

1 yorum: