Tampilkan postingan dengan label KASUS 4. Tampilkan semua postingan

PROGRAM MENCETAK BILANGAN YANG HABIS DIBAGI 3 DAN 5

 algoritma dan program untuk mencetak bilangan yang habis dibagi 3 dan 5 antara 1 
 sampai dengan 100.

#include <iostream>
#include <conio.h>
using namespace std;
class bilangan
{

public:

int proses();

private:

int i;

};
int bilangan::proses()
{
cout<<"Program Mencetak Bilangan yg Habis dibagi 3 dan 5";
cout<<" antara 1 sampai 100 : \n";
for(int i=1; i<=100; i++)
{
if(i % 3==0)
{cout<<i<<endl;}
else(i % 5==0);
{cout<<i<<endl;}
}
}
int main()
{
bilangan x;

x.proses();
getch();


Read more

PROGRAM MENGHITUNG PERKALIAN DENGAN PENJUMLAHAN


menghitung perkaliandengan penjumlahan "

#include <iostream>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
    int a,b,jumlah=0;
    cout<<"PROGGRAM MENGHITUNG PERKALIAN DENGAN CARA PENJUMLAHAN\n";
    cout<<"masukan nilai a : ";cin>>a;
    cout<<"masukan nilai b : ";cin>>b;
    for(int i=1;i<=b;i++)
    jumlah+=a;
    if(b<0)jumlah=-jumlah;
    cout<<a<<"x"<<b<<"="<<jumlah;
    return 0;
}



RAPTOR :


Read more

PROGRAM MENGHITUNG HASIL PERPANGKATAN

menghitung hasil perpangkaatan

#include <iostream>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
int x,y,i;
int pangkat=1;
cout<<"menghitung hasil perpangkatan\n";
cout<<"tulis sebuah bilangan : ";cin>>x;
cout<<"pangkat : ";cin>>y;
for(i=1;i<=y;i++)
pangkat*=x;
cout<<x<<" pangkat "<<y<<" =  "<<pangkat;
    return 0;
}


RAPTOR :


Read more

PROGRAM MENCRI RATA-RATA NILAI POSITIF INTEGER


 MENCRI RATA-RATA NILAI POSITIF INTEGER



#include <iostream>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
int n=1;
float r,x,o,j=0;
cout<<"data ke-1 : ";cin>>o;
while(n<10){
    cout<<"data ke- : "<<n+1<<"=";
    cin>>x;
    j+=x;
    n++;
}
float h=j+o;
cout<<"jumlah ="<<h<<endl;
cout<<"rata-rata ="<<h/n;
    return 0;
}




RAPTOR :




Read more

PROGRAM MENCARI NILAI RATA-RATA

mencari nilai rata-rata "


#include <iostream>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
int i,n,jumlah,x;
float rata;
cout<<"banyak data :";cin>>n;
jumlah=0;
for(i=1;i<=n;i++){
    cout<<"data ke :"<<i;cin>>x;
    jumlah+=x;
}
rata=(float)jumlah/n;
cout<<"rata-rata"<<rata;
    return 0;
}



RAPTOR :



Read more

KASUS 4.2









Bilangan ganjil dari 0 sampai 10 diawali dengan 1, kemudian bertambah dengan 2 atau bilangan ganjil adalah 
bilangan yang bila dibagi 2 bersisa 1.

#include <iostream>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
int a=1;
do{if(a%2==1)
cout<<a<<endl;
a++;
}while(a<=10);
   
    return 0;
}


 RAPTOR :

 
Read more

PROGRAM PERULANGAN LOOP



perulnga lopp

#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
    cout<<"bilangan 1 --------- 4"<<endl;
    for(int i=1;i<=4;i++){
        cout<<i<<endl;
    }
    return 0;
}





Raptor :



Read more