#include <stdio.h>
main()
{
int data[9]={5,3,4,6,1,6,7,8,3}; /* Data ini bisa anda ganti dengan data yang anda inginkan*/
int i,Y,R,J,L;
double V;
L=sizeof(data)/sizeof(int);
Y=data[0];
for (i=0;i<L;i++)
{
if(Y<data[i])
{
Y=data[i];
}
}
R=data[0];
for (i=0;i<L;i++)
{
if(R>data[i])
{
R=data[i];
}
}
J=0;
for (i=0;i<L;i++)
{
J=J+data[i];
}
V= (double)J/L;
printf("Nilai Terbesar = %d\n",Y);
printf("Nilai Terkecil = %d\n",R);
printf("Nilai Jumlah = %d\n",J);
printf("Nilai Rata - rata = %g\n",V);
printf("Nilai data = %s\t","");
for (i=0;i<L;i++)
{
printf(" %d\t",data[i]);
}
printf(" %s\n","");
int data2[L];
printf("Nilai data = %s\t","");
for (i=0;i<L;i++)
{
data2[i] = data[i];
printf(" %d\t",data2[i]);
}
printf(" %s\n","");
printf("Cek Kesamaan Data = %s\n","");
for (i=0;i<L;i++)
{
printf(" %d\t",data[i]);
printf(" = %d\t",data2[i]);
if(data [i] == data2[i]){
printf(" Data Sama %s\t","");
}else{
printf(" Data Tidak Sama %s\t","");
}
printf(" %s\n","");
}
printf(" %s\n","");
getch();
}