HARDEV’ INSKOM
Jadilah Diri Sendiri

Jan
27

persamaan-matrik1#include <iostream.h>
void main()
{
int xi[7];
float yi[7];
double xiyi;
int xi2;
int x;
int sigma_xi;
double xi_rata2;
double sigma_yi;
double yi_rata2;
double sigmaxiyi;
double sigma_xi2;
double a1;
double a0;
int n=7;
xi[0]=3;
xi[1]=5;
xi[2]=6;
xi[3]=8;
xi[4]=9;
xi[5]=10;
xi[6]=12;
yi[0]=13;
yi[1]=23;
yi[2]=18;
yi[3]=15;
yi[4]=17;
yi[5]=22;
yi[6]=25;

cout<<“x dan y :”<<endl;
cout<<endl;

for (x=0;x<=6;x++)
{
cout<<“xi = “<<xi[x]<<endl;
}
cout<<endl;
sigma_xi = xi[0]+xi[1]+xi[2]+xi[3]+xi[4]+xi[5]+xi[6];
cout<<“sigma x = “<<sigma_xi<<endl;

xi_rata2= sigma_xi/n;
cout<<“x rata2 = “<<xi_rata2<<endl;
cout<<endl;

for (x=0;x<=6;x++)
{
cout<<“y = “<<yi[x]<<endl;
}
cout<<endl;
sigma_yi = yi[0]+yi[1]+yi[2]+yi[3]+yi[4]+yi[5]+yi[6];
cout<<“sigma y = “<<sigma_yi<<endl;

yi_rata2= sigma_yi/n;
cout<<“y rata2 = “<<yi_rata2<<endl;

cout<<“nilai x.y”<<endl;
cout<<endl;
for (x=0;x<=6;x++)
{
xiyi=xi[x]*yi[x];
cout<<“x.y = “<<xiyi<<endl;
}
cout<<endl;
cout<<“nilai sigma x.y”<<endl;

sigmaxiyi = xi[0]*yi[0]+xi[1]*yi[2]+xi[3]*yi[4]+xi[5]*yi[6]
+xi[4]*yi[4]+xi[5]*yi[5]+xi[6]*yi[6];
cout<<“sigma x.y =”<<sigmaxiyi<<endl;

cout<<“nilai x kuadrat”<<endl;
cout<<endl;
for (x=0;x<=6;x++)
{
xi2=xi[x]*xi[x];
cout<<“x2 =”<<xi2<<endl;
}
cout<<endl;
cout<<“nilai sigma x kuadrat”<<endl;
cout<<endl;
sigma_xi2 = xi[0]*xi[0]+xi[1]*xi[2]+xi[3]*xi[4]+xi[5]*xi[6]
+xi[4]*xi[4]+xi[5]*xi[5]+xi[6]*xi[6];
cout<<“sigma xy = “<<sigma_xi2<<endl;
a1= ((n*sigmaxiyi)-(sigma_xi*sigma_yi))/((n*sigma_xi2)-(sigma_xi*sigma_xi));
cout<< “nilai a1″<<endl;
cout<<endl;
cout<<“a1 = “<<a1<<endl;
cout<<endl;
a0= (yi_rata2)-(a1*xi_rata2);
cout<<“nilai a0 adalah”<<endl;
cout<<endl;
cout<<“a0 = “<<a0<<endl;
cout<<endl;
}

Jan
22

gue-banget14#include
int main () {

int i, j;
int A[2][2], B[2][2], C[2][2];

A[0][0] = 4;
A[0][1] = 6;
A[1][0] = 7;
A[1][1] = 2;
B[0][0] = 3;
B[0][1] = 7;
B[1][0] = 8;
B[1][1] = 1;

cout<<“%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%”<<endl;
cout<<“Nama : HARAMAINI”<<endl;
cout<<“Nim : 0708002010043″<<endl;
cout<<“Prodi : D-3 INSKOM” <<endl;
cout<<“%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%”<<endl;
cout<<“Hasil :”<<endl;
cout<<endl;

for(i=0; i<=1; i++)
{
for(j=0; j<=1; j++)
{
C[i][j] = A[i][j] – B[i][j];
cout<<C[i][j]<<endl;
}
cout<<endl;

}

return 0;
}

Jan
14

tugas-komputasi-numerik4#include
#include
void main()
{
int baris, kolom;
int i, j;
int A[25][25];
int B[25][25];
int X[25][25];
cout<<“Nama : Haramaini”<<endl;
cout<<“NIM : 0708002010043″<<endl;
cout<<“Prodi : D3-Inskom”<<endl;
cout<<“===============================”<<endl;
cout<<endl;
/******* Masukkan ordo *******/
printf(“masukkan ordo baris = “);
scanf(“%i”,&baris);
printf(“masukkan ordo kolom = “);
scanf(“%i”,&kolom);
/******* Masukkan matriks A *******/
for(i=0;i<baris;i++)
{ for(j=0;j<kolom;j++)
{ printf(“input data matrik A[%i][%i] : “,i+1,j+1);
scanf(“%i”,&A[i][j]);
}
}
/******** Masukkan matriks B ********/
for(i=0;i<baris;i++)
{ for(j=0;j<kolom;j++)
{ printf(“input data matrik B[%i][%i] : “,i+1,j+1);
scanf(“%i”,&B[i][j]);
}
}
/******** Proses penjumlahan matriks A dan B ********/
for(i=0;i<baris;i++)
{ for(j=0;j<kolom;j++)
{ X[i][j]=A[i][j]+B[i][j];
}
}
/******** Cetak isi matriks A ********/
printf(“\n matrik A\n”);
for(i=0;i<baris;i++)
{ for(j=0;j<kolom;j++)
printf(“%6i”,A[i][j]);
printf(“\n”);
}
printf(“\n”);
/******** Cetak isi matriks B *******/
printf(“\n matrik B\n”);
for(i=0;i<baris;i++)
{ for(j=0;j<kolom;j++)
printf(“%6i”,B[i][j]);printf(“\n”);
}
printf(“\n”);
/******** Cetak hasil penjumlahan matriks A dan B *******/
printf(“\n matrik penjumlahan A+B\n”);
for(i=0;i<baris;i++)
{ for(j=0;j<kolom;j++)
printf(“%6i”,X[i][j]);printf(“\n”);
}
printf(“\n\n”);
}