#include <cstdlib>
#include <iostream>

using namespace std;

class postest
{
      public:
             postest();
             void faktorial();
             void aritmatika();
     
      private:
              int i, x,n,a,b,hasil;
};

postest::postest(){
     cout << "postest jam 09.00" << endl<<endl;
     cout<<"\tIrhas"<<endl;
     cout<<"\t12018052"<<endl<<endl;
}

void postest::faktorial(){
     hasil=1;
     cout<<"masukkan nilai faktorial :";
     cin>>x;
     for(i=1; i<=x; i++){
         hasil = hasil*i;
         if(i<x){
               cout<<i<<"x";}
         else{
              cout<<i;
              }
     }
     cout<<"\nhasil faktorial "<<x<<" = "<<hasil<<endl;
}

void postest::aritmatika(){
    cout<<"masukkan jumlah deret :";
    cin>>n;
    cout<<"masukkan suku awal :";
    cin>>a;
    cout<<"masukkan beda :";
    cin>>b;
    for(i=0; i<n; i++){
        cout <<a+(i*b)<<", ";
        }
    cout<<endl;       
}

int main(int argc, char *argv[])
{
    postest x;   
    x.faktorial();
    cout<<endl;
    x.aritmatika();
    system("PAUSE");
    return EXIT_SUCCESS;
}

Leave a Reply

Subscribe to Posts | Subscribe to Comments

Popular Post

- Copyright © Irhaz Share -Irhaz Matru- Powered by Blogger - Design by Irhaz Rangga Kala -