7 Ekim 2013 Pazartesi

Faktoriyel Hesaplayan C Programı

#include <stdio.h>

int main(void)
{
int sayi ,n = 1;
printf("SAYİ : ");
scanf("%d",&sayi);

if(sayi < 0){
printf("Negatif sayıların faktöriyeli yoktur...\n");

}else{

for(int i = 1; i <= sayi; i++ ){
n *= i;
}
printf("FAKTORİYEL SONUCU : %d\n",n);

}

return 0;
}

Hiç yorum yok:

Yorum Gönder