SEMESTER 1
LOGIKA & ALGORITMA
TUGAS TELOMPOK PERTEMUAN 6
# KELOMPOK SILENT TEAM #
1. HARIS SYAEFUL AMRI [NIM : 13190183]
2. PATAR SAMUEL [NIM : 13190497]
2. PATAR SAMUEL [NIM : 13190497]
3. IKHWAN HAFIZH [NIM : 13190090]
4. MULYANSYAH YUSUF [NIM : 13190088]
5. SOLIKIN [NIM : 13190515]
KELAS : 13.1B.07
JURUSAN : TEKNIK KOMPUTER
1. Program Pangkat Rekrusif
3. Program Deret Fibonacci
1. Program Pangkat Rekrusif
Program Menggunakan Borland c++ 5.02
Input Script :
#include <conio.h>
#include <iostream.h>
int main()
{
int bil,n,hasil,i;
char lagi;
clrscr();
lagi:
cout<<" # KELOMPOK SILENT TEAM # "<<endl;
cout<<" ===================================="<<endl;
cout<<" |NO| NAMA | NIM |"<<endl;
cout<<" ===================================="<<endl;
cout<<" |1 | HARIS SYAEFUL AMRI | 13190183 |"<<endl;
cout<<" |2 | PATAR SAMUEL | 13190497 |"<<endl;
cout<<" |3 | IKHWAN HAFIZH | 13190090 |"<<endl;
cout<<" |4 | MULYANSYAH YUSUF | 13190088 |"<<endl;
cout<<" |5 | SOLIKIN | 13190515 |"<<endl;
cout<<" ===================================="<<endl;
cout<<" KELAS : 13.1B.07 "<<endl;
cout<<" JURUSAN : TEKNIK KOMPUTER "<<endl;
cout<<" TAHUN AJARAN : 2019/2020 "<<endl;
cout<<endl;
cout<<"=============================================\n";
cout<<"| PROGRAM PANGKAT (REKURSIF) |\n";
cout<<"=============================================\n\n";
cout<<"Masukan Bilangan = ";
cin>>hasil;
cout<<"Dipangkatkan = ";
cin>>n;
if(n==0)
cout<<"hasil=1"<<endl;
else{
bil=hasil;
for(i=1;i<n;i++){
hasil=hasil*bil;
}
}
cout<<"Hasilnya Adalah = "<<hasil;
cout<<endl;
cout<<"Coba Lagi? (Y atau T) : " ;
cin>>lagi;
if(lagi =='y' || lagi =='Y')
{
clrscr();
goto lagi;}
else
cout<<"\n";
getch();
}
Output Program :
2. Program Mencari Faktorial
#include <conio.h>
#include <iostream.h>
int main()
{
int bil,n,hasil,i;
char lagi;
clrscr();
lagi:
cout<<" # KELOMPOK SILENT TEAM # "<<endl;
cout<<" ===================================="<<endl;
cout<<" |NO| NAMA | NIM |"<<endl;
cout<<" ===================================="<<endl;
cout<<" |1 | HARIS SYAEFUL AMRI | 13190183 |"<<endl;
cout<<" |2 | PATAR SAMUEL | 13190497 |"<<endl;
cout<<" |3 | IKHWAN HAFIZH | 13190090 |"<<endl;
cout<<" |4 | MULYANSYAH YUSUF | 13190088 |"<<endl;
cout<<" |5 | SOLIKIN | 13190515 |"<<endl;
cout<<" ===================================="<<endl;
cout<<" KELAS : 13.1B.07 "<<endl;
cout<<" JURUSAN : TEKNIK KOMPUTER "<<endl;
cout<<" TAHUN AJARAN : 2019/2020 "<<endl;
cout<<endl;
cout<<"=============================================\n";
cout<<"| PROGRAM PANGKAT (REKURSIF) |\n";
cout<<"=============================================\n\n";
cout<<"Masukan Bilangan = ";
cin>>hasil;
cout<<"Dipangkatkan = ";
cin>>n;
if(n==0)
cout<<"hasil=1"<<endl;
else{
bil=hasil;
for(i=1;i<n;i++){
hasil=hasil*bil;
}
}
cout<<"Hasilnya Adalah = "<<hasil;
cout<<endl;
cout<<"Coba Lagi? (Y atau T) : " ;
cin>>lagi;
if(lagi =='y' || lagi =='Y')
{
clrscr();
goto lagi;}
else
cout<<"\n";
getch();
}
Output Program :
2. Program Mencari Faktorial
Program Menggunakan Borland c++ 5.02
Input Script :
#include <iostream>
#include <conio.h>
int main()
{
int bil, n;
long int hasil;
char lagi;
clrscr();
lagi:
cout<<" # KELOMPOK SILENT TEAM # "<<endl;
cout<<" ===================================="<<endl;
cout<<" |NO| NAMA | NIM |"<<endl;
cout<<" ===================================="<<endl;
cout<<" |1 | HARIS SYAEFUL AMRI | 13190183 |"<<endl;
cout<<" |2 | PATAR SAMUEL | 13190497 |"<<endl;
cout<<" |3 | IKHWAN HAFIZH | 13190090 |"<<endl;
cout<<" |4 | MULYANSYAH YUSUF | 13190088 |"<<endl;
cout<<" |5 | SOLIKIN | 13190515 |"<<endl;
cout<<" ===================================="<<endl;
cout<<" KELAS : 13.1B.07 "<<endl;
cout<<" JURUSAN : TEKNIK KOMPUTER "<<endl;
cout<<" TAHUN AJARAN : 2019/2020 "<<endl;
cout<<endl;
cout<<"=============================================\n";
cout<<"| PROGRAM MENCARI NILAI FAKTORIAL |\n";
cout<<"| DARI BILANGAN DESIMAL |\n";
cout<<"=============================================\n\n";
cout<<"Masukan Angka = ";
cin>> n;
hasil=1;
for(bil=n; bil>=1;bil--)
{
hasil=hasil*bil;
}
cout<<"Hasil Faktorial = "<<hasil<<"\n";
cout<<endl;
cout<<"Coba Lagi? (Y atau T) : " ;
cin>>lagi;
if(lagi =='y' || lagi =='Y')
{
clrscr();
goto lagi;}
else
cout<<"\n";
getch();
}
Output Program :
#include <iostream>
#include <conio.h>
int main()
{
int bil, n;
long int hasil;
char lagi;
clrscr();
lagi:
cout<<" # KELOMPOK SILENT TEAM # "<<endl;
cout<<" ===================================="<<endl;
cout<<" |NO| NAMA | NIM |"<<endl;
cout<<" ===================================="<<endl;
cout<<" |1 | HARIS SYAEFUL AMRI | 13190183 |"<<endl;
cout<<" |2 | PATAR SAMUEL | 13190497 |"<<endl;
cout<<" |3 | IKHWAN HAFIZH | 13190090 |"<<endl;
cout<<" |4 | MULYANSYAH YUSUF | 13190088 |"<<endl;
cout<<" |5 | SOLIKIN | 13190515 |"<<endl;
cout<<" ===================================="<<endl;
cout<<" KELAS : 13.1B.07 "<<endl;
cout<<" JURUSAN : TEKNIK KOMPUTER "<<endl;
cout<<" TAHUN AJARAN : 2019/2020 "<<endl;
cout<<endl;
cout<<"=============================================\n";
cout<<"| PROGRAM MENCARI NILAI FAKTORIAL |\n";
cout<<"| DARI BILANGAN DESIMAL |\n";
cout<<"=============================================\n\n";
cout<<"Masukan Angka = ";
cin>> n;
hasil=1;
for(bil=n; bil>=1;bil--)
{
hasil=hasil*bil;
}
cout<<"Hasil Faktorial = "<<hasil<<"\n";
cout<<endl;
cout<<"Coba Lagi? (Y atau T) : " ;
cin>>lagi;
if(lagi =='y' || lagi =='Y')
{
clrscr();
goto lagi;}
else
cout<<"\n";
getch();
}
Output Program :
3. Program Deret Fibonacci
Program Menggunakan Borland c++ 5.02
Input Script :
#include <conio.h>
#include <iostream>
int fibonaci(int n);
int fibonaci(int n)
{
if (n == 0) return 0;
else if(n == 1) return 1;
else return (fibonaci(n-1) + fibonaci(n-2));
}
int main()
{
int jumlah;
cout<<" # KELOMPOK SILENT TEAM # "<<endl;
cout<<" ===================================="<<endl;
cout<<" |NO| NAMA | NIM |"<<endl;
cout<<" ===================================="<<endl;
cout<<" |1 | HARIS SYAEFUL AMRI | 13190183 |"<<endl;
cout<<" |2 | PATAR SAMUEL | 13190497 |"<<endl;
cout<<" |3 | IKHWAN HAFIZH | 13190090 |"<<endl;
cout<<" |4 | MULYANSYAH YUSUF | 13190088 |"<<endl;
cout<<" |5 | SOLIKIN | 13190515 |"<<endl;
cout<<" ===================================="<<endl;
cout<<" KELAS : 13.1B.07 "<<endl;
cout<<" JURUSAN : TEKNIK KOMPUTER "<<endl;
cout<<" TAHUN AJARAN : 2019/2020 "<<endl;
cout<<endl;
cout<<"=============================================\n";
cout<<"| PROGRAM DERET BILANGAN FIBONACCI |\n";
cout<<"=============================================\n";
cout<< "Jumlah Bilangan Fibonaci Yang Ingin Ditampilkan : ";
cin >> jumlah;
cout <<"Bilangan Fibonaci dari " <<jumlah<< " hingga 0 yang pertama adalah : ";
for(int i=0; i<=jumlah; i++)
{
cout<<" "<<fibonaci(i);
}
cout<<endl;
getch();
}
Output Program :
#include <conio.h>
#include <iostream>
int fibonaci(int n);
int fibonaci(int n)
{
if (n == 0) return 0;
else if(n == 1) return 1;
else return (fibonaci(n-1) + fibonaci(n-2));
}
int main()
{
int jumlah;
cout<<" # KELOMPOK SILENT TEAM # "<<endl;
cout<<" ===================================="<<endl;
cout<<" |NO| NAMA | NIM |"<<endl;
cout<<" ===================================="<<endl;
cout<<" |1 | HARIS SYAEFUL AMRI | 13190183 |"<<endl;
cout<<" |2 | PATAR SAMUEL | 13190497 |"<<endl;
cout<<" |3 | IKHWAN HAFIZH | 13190090 |"<<endl;
cout<<" |4 | MULYANSYAH YUSUF | 13190088 |"<<endl;
cout<<" |5 | SOLIKIN | 13190515 |"<<endl;
cout<<" ===================================="<<endl;
cout<<" KELAS : 13.1B.07 "<<endl;
cout<<" JURUSAN : TEKNIK KOMPUTER "<<endl;
cout<<" TAHUN AJARAN : 2019/2020 "<<endl;
cout<<endl;
cout<<"=============================================\n";
cout<<"| PROGRAM DERET BILANGAN FIBONACCI |\n";
cout<<"=============================================\n";
cout<< "Jumlah Bilangan Fibonaci Yang Ingin Ditampilkan : ";
cin >> jumlah;
cout <<"Bilangan Fibonaci dari " <<jumlah<< " hingga 0 yang pertama adalah : ";
for(int i=0; i<=jumlah; i++)
{
cout<<" "<<fibonaci(i);
}
cout<<endl;
getch();
}
Output Program :
No comments:
Post a Comment