#include <iostream>
#include <conio.h>
using namespace std;
int main()
{ int am;
cout<<"Tek Kotek Kotek Kotek Anak Ayam Turun Berkotek 2x "<<endl;
cout<<"Anak ayam turunlah : ";cin>>am;
for (am; am>=2; am--){
cout<<"Anak Ayam Turunlah "<<am <<" Mati Satu Tinggallah "<<am-1<<endl;
}
cout<<"Anak Ayam Turunlah "<<am <<" Mati Satu Tinggal induknya ................ "<<endl;
getch();
return 0;
}
Monday, 18 May 2020
Sunday, 17 May 2020
PERKALIAN DENGAN BERBAGAI FUNGSI PERULANGAN
#include <conio.h>
#include <iostream>
using namespace std;
int main()
{
int pilih,angka,perkalian;
char a;
atas:
cout<<"|---------------------------------------------|"<<endl;
cout<<"| PERKALIAN DENGAN BERBAGAI FUNGSI PERULANGAN |"<<endl;
cout<<"|_____________________________________________|"<<endl;
cout<<"| 1. FOR NAIK |"<<endl;
cout<<"| 2. FOR TURUN |"<<endl;
cout<<"| 3. WHILE NAIK |"<<endl;
cout<<"| 4. WHILE TURUN |"<<endl;
cout<<"| 5. DO-WHILE NAIK |"<<endl;
cout<<"| 6. DO-WHILE TURUN |"<<endl;
cout<<"|_____________________________________________|"<<endl<<endl;
cout<<"Masukkan Pilihan Anda : ";
cin>>pilih;
if (pilih==1)
{
cout<<"PERKALIAN MENGGUNAKAN FOR NAIK "<<endl<<endl;
cout<<"Masukkan Nilai Perkalian : ";
cin>>perkalian;
for(angka=1;angka<=10;angka++)
{
cout<<angka<<" x "<<perkalian<<" = "<<(angka*perkalian)<<endl;
} //.....................................................................................
#include <iostream>
using namespace std;
int main()
{
int pilih,angka,perkalian;
char a;
atas:
cout<<"|---------------------------------------------|"<<endl;
cout<<"| PERKALIAN DENGAN BERBAGAI FUNGSI PERULANGAN |"<<endl;
cout<<"|_____________________________________________|"<<endl;
cout<<"| 1. FOR NAIK |"<<endl;
cout<<"| 2. FOR TURUN |"<<endl;
cout<<"| 3. WHILE NAIK |"<<endl;
cout<<"| 4. WHILE TURUN |"<<endl;
cout<<"| 5. DO-WHILE NAIK |"<<endl;
cout<<"| 6. DO-WHILE TURUN |"<<endl;
cout<<"|_____________________________________________|"<<endl<<endl;
cout<<"Masukkan Pilihan Anda : ";
cin>>pilih;
if (pilih==1)
{
cout<<"PERKALIAN MENGGUNAKAN FOR NAIK "<<endl<<endl;
cout<<"Masukkan Nilai Perkalian : ";
cin>>perkalian;
for(angka=1;angka<=10;angka++)
{
cout<<angka<<" x "<<perkalian<<" = "<<(angka*perkalian)<<endl;
} //.....................................................................................
Tuesday, 12 May 2020
Insertion Sort
#include<iostream>
#include<conio.h>
using namespace std;
int data[10];
int n;
int main()
{
int tmp,i,j;
cout<<"-------------------------------------------------"<<endl;
cout<<"INSERTION SORT DESCENDING"<<endl;
cout<<"-------------------------------------------------"<<endl;
cout<<"INPUTKAN BANYAKNYA DATA = ";
cin>>n;
cout<<"-------------------------------------------------"<<endl;
for(int i=0;i<n;i++)
{
cout<<"INPUTKAN DATA KE-"<<(i+1)<<" = " ;
cin>>data[i];
}
#include<conio.h>
using namespace std;
int data[10];
int n;
int main()
{
int tmp,i,j;
cout<<"-------------------------------------------------"<<endl;
cout<<"INSERTION SORT DESCENDING"<<endl;
cout<<"-------------------------------------------------"<<endl;
cout<<"INPUTKAN BANYAKNYA DATA = ";
cin>>n;
cout<<"-------------------------------------------------"<<endl;
for(int i=0;i<n;i++)
{
cout<<"INPUTKAN DATA KE-"<<(i+1)<<" = " ;
cin>>data[i];
}
Monday, 11 May 2020
Program Perkalian For
#include<iostream>
using namespace std;
int main()
{
int a,b;
atas:
cout<<" Masukan Nilai Perkalian : ";cin>>b;
for(a=1;a<=10;a++)
{
cout<<a <<" X " <<b <<" = "<<a*b<<endl;
}
Subscribe to:
Posts (Atom)