Minggu, 23 Maret 2014

a) Write a program that reads a nonnegative integer and computes and prints its factorial.
#include <stdio.h>

int main(){

    int fact, result = 1, i;

    printf("Masukan angka non negative: ");

    scanf("%d", &fact);

    if(fact>0){

       for(i=fact; i>=1; i--){

          result *= i;

       }

       printf("Hasil dari %d! adalah %d.\n", fact, result);

    }

    system("pause");

}
23 Mar 2014

0 komentar:

Posting Komentar

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.