FAKULTAS TEKNOLOGI INFORMASI DAN KOMUNIKASI
Selamat Datang di Forum FTIKOM.

"Information & Communication Technology Faculty"
"UNIVERSITAS MULAWARMAN"


Daftarkan Diri Anda. Selamat Berposting.
Ramekan Forum kita guna memajukan Fakultas kita.

C++ MENGHIRUNG NILAI FAKTORIAL Logo-u12
Best Regard

Join the forum, it's quick and easy

FAKULTAS TEKNOLOGI INFORMASI DAN KOMUNIKASI
Selamat Datang di Forum FTIKOM.

"Information & Communication Technology Faculty"
"UNIVERSITAS MULAWARMAN"


Daftarkan Diri Anda. Selamat Berposting.
Ramekan Forum kita guna memajukan Fakultas kita.

C++ MENGHIRUNG NILAI FAKTORIAL Logo-u12
Best Regard
FAKULTAS TEKNOLOGI INFORMASI DAN KOMUNIKASI
Would you like to react to this message? Create an account in a few clicks or log in to continue.

C++ MENGHIRUNG NILAI FAKTORIAL

Go down

C++ MENGHIRUNG NILAI FAKTORIAL Empty C++ MENGHIRUNG NILAI FAKTORIAL

Post  novay Fri Apr 08, 2011 4:48 pm

DISINI SAYA AKAN MEMBUAT SEBUAH PROGRAM UNTUK MENGHITUNG FAKTORIAL.
SUATU FAKTORIAL DI DIFINISIKAN SEPERTI BERIKUT:

N!=N X(N-1)X(N-2)X......X 2 X 1

SEBAGAI CONTOH:
2!= 2 X 1 = 2
3!= 3 X 2 X 1 = 6
4!= 4 X 3 X 2 X 1 = 24




BERIKUT SYNTAXNYA :

// Menghitung Nilai Faktorial

#include <iostream.h> //untuk mengenali fungsi cin & cout
#include <conio.h> //untuk mengenali fungsi getche

void main()
{
int x, n;
long int nilai;
cout<<"MENGHITUNG NILAI FAKTORIAL"<<endl<<endl;
cout<<"Masukkan nilai n = ";cin>>n;
nilai=1;
for(x=n; x>=1;x--)
{
nilai=nilai*x;
}
cout<<endl;
cout<<"Jadi, n! dari "<<n<<" adalah "<<nilai<<"\n";
getch();
}


KALO OUTPUTNYA SPERTI INI BRAY...


NIH BRAY:
novay
novay
Forum Founder [Joker]
Forum Founder [Joker]

Posts : 488
Points : 840
Reputasi : 12
Age : 32
Location : Berau City
Universitas : University Of Mulawarman
Fakultas : Faculty Of Information and Communication Technology

http://ftikom-unmul.nstars.org

Kembali Ke Atas Go down

Kembali Ke Atas

- Similar topics

 
Permissions in this forum:
Anda tidak dapat menjawab topik