putriduana

#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]=4;
xi[1]=3;
xi[2]=1;
xi[3]=1;
xi[4]=15;
xi[5]=6;
xi[6]=12;
yi[0]=25.5;
yi[1]=24;
yi[2]=13;
yi[3]=24;
yi[4]=16;
yi[5]=26;
yi[6]=46;

;

cout<<“Nilai x dan y adalah”<<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;
cout<<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;
cout<<endl;
yi_rata2= sigma_yi/n;
cout<<“y rata2 = “<<yi_rata2<<endl;

cout<<“nilai x.y”<<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;
cout<<endl;
sigmaxiyi = xi[0]*yi[0]+xi[1]*yi[1]+xi[2]*yi[2]+xi[3]*yi[3]
+xi[4]*yi[4]+xi[5]*yi[5]+xi[6]*yi[6];
cout<<“sigma x.y =”<<sigmaxiyi<<endl;

cout<<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[1]+xi[2]*xi[2]+xi[3]*xi[3]
+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;

a0= (yi_rata2)-(a1*xi_rata2);
cout<<“nilai a0 adalah”<<endl;
cout<<endl;
cout<<“a0 = “<<a0<<endl;

}

gambar-milsa

#include <iostream.h>

int main () {

cout<<“NAMA : SYARIFAH MILSA “<<endl;

cout<<“NIM : 0708002010046″<<endl;

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<<“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;

}

milsa1

#include <iostream.h>
#include <stdio.h>
void main()
{
int baris, kolom;
int i, j;
int A[25][25];
int B[25][25];
int X[25][25];
cout<<“Nama        : Syarifah Milsa”<<endl;
cout<<“NIM        : 0708002010046″<<endl;
cout<<“Prodi        : D3-Inskom”<<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”);
}

HASIL

gambar2

phonna

Juli 2017
S S R K J S M
« Jan    
 12
3456789
10111213141516
17181920212223
24252627282930
31  

Komentar Terbaru