• RSS
  • Delicious
  • Digg
  • Facebook
  • Twitter
  • Linkedin
  • Heading 1 Here:Enter the heading 1 description here.Go to blogger edit html,find these words and replace it with your own description ...
  • Heading 2 Here:Enter the heading 2 description here.Go to blogger edit html,find these words and replace it with your own description ...
  • Heading 3 Here:Enter the heading 3 description here.Go to blogger edit html,find these words and replace it with your own description ...
  • Heading 4 Here:Enter the heading 4 description here.Go to blogger edit html,find these words and replace it with your own description ...
  • Heading 5 Here:Enter the heading 5 description here.Go to blogger edit html,find these words and replace it with your own description ...
  • SLIDE-1-TITLE-HERE

    Welcome to Blogger.Go to Blogger edit html and find these sentences.Now replace these text/sentences with your own descriptions.This theme is convert to Blogger by Premiumbloggertemplates.com.Download this template and more Premium Blogger Templates From PremiumBloggerTemplates.com...

  • SLIDE-2-TITLE-HERE

    Welcome to Blogger.Go to Blogger edit html and find these sentences.Now replace these text/sentences with your own descriptions.This theme is convert to Blogger by Premiumbloggertemplates.com.Download this template and more Premium Blogger Templates From PremiumBloggerTemplates.com...

  • SLIDE-3-TITLE-HERE

    Welcome to Blogger.Go to Blogger edit html and find these sentences.Now replace these text/sentences with your own descriptions.This theme is convert to Blogger by Premiumbloggertemplates.com.Download this template and more Premium Blogger Templates From PremiumBloggerTemplates.com...

  • SLIDE-4-TITLE-HERE

    Welcome to Blogger.Go to Blogger edit html and find these sentences.Now replace these text/sentences with your own descriptions.This theme is convert to Blogger by Premiumbloggertemplates.com.Download this template and more Premium Blogger Templates From PremiumBloggerTemplates.com...

Kamis, 21 April 2011

Mencari nilai Faktorial

Posted by Cipto Tri Raharjo On 20.43 No comments

#include <iostream.h>
#include <conio.h>
class faktorial {
public:
int proses();
void keluaran();
private:
int n,faktor;
};

int faktorial::proses()
{
cout<<"masukan angka yg akan di faktorialkan : ";
cin>>n;
faktor=1;
if(n>0)
{
for(int i=1; i<=n; i++)
{
faktor*=i;
}
}
else if(n=0)
{
faktor=1;
}
else
{
cout<<"tidak ada";
}
return faktor;
}
void faktorial::keluaran()
{
cout<<endl<<endl<<"faktorial dari "<<n<<"! = "<<faktor;
}
int main()
{
faktorial bilangan;
bilangan.proses();
bilangan.keluaran();
getch();
}

0 komentar:

Posting Komentar