Assalamualaikum
Hey yo yo guys
Back with me again to my post
At this time I would like to share my code to make some program
Let’s do this
First—–
Tabel nilai rata rata
#include <stdio.h>
int nilai_siswa[3][3]=
{{81,90,62},{50,83,87},{89,55,65},{77,70,92}};
void main()
{
printf(” |—————————————————————-|\n”);
printf(” | NO || NAMA MAHASISWA || BAHASA || MATEMATIKA || DIGITAL |\n”);
printf(” |—-||——————||———-||————–||———-|\n”);
printf(” | 1 || AHMAD || %d || %d || %d |\n”,nilai_siswa[0][0],nilai_siswa[0][1],nilai_siswa[0][2],nilai_siswa[0][3]);
printf(” | 2 || ADANG || %d || %d || %d |\n”,nilai_siswa[1][0],nilai_siswa[1][1],nilai_siswa[1][2],nilai_siswa[1][3]);
printf(” | 3 || DANI’ || %d || %d || %d |\n”,nilai_siswa[2][0],nilai_siswa[2][1],nilai_siswa[2][2],nilai_siswa[2][3]);
printf(” | 4 || EDI’ || %d || %d || %d |\n”,nilai_siswa[3][0],nilai_siswa[3][1],nilai_siswa[3][2],nilai_siswa[3][3]);
printf(” |—————————————————————-|\n\n\n\n”);
int ahmad ,adang ,dani ,edi;
ahmad=nilai_siswa[0][0]+nilai_siswa[0][1]+nilai_siswa[0][2]+nilai_siswa[0][3]/3;
adang=nilai_siswa[1][0]+nilai_siswa[1][1]+nilai_siswa[1][2]+nilai_siswa[1][3]/3;
dani=nilai_siswa[2][0]+nilai_siswa[2][1]+nilai_siswa[2][2]+nilai_siswa[2][3]/3;
edi=nilai_siswa[3][0]+nilai_siswa[3][1]+nilai_siswa[3][2]+nilai_siswa[3][3]/3;
printf(” |—————————|\n”);
printf(” | NO MAHASISWA || RATA-RATA |\n”);
printf(” |————–||———–|\n”);;
printf(” | 1 || %d |\n”,ahmad);
printf(” | 2 || %d |\n”,adang);
printf(” | 3 || %d |\n”,dani);
printf(” | 4 || %d |\n”,edi);
printf(” |—————————|\n\n\n”);
}
The output program like this
Okay the second one is——
Pencari bilangan prima
#include <stdio.h>
void main()
{
int n,i,x;
printf(“masukkan banyak data = “); scanf(“%d”, &n);
int banyak_data[n];
for (i=2;i<=n;i++)
{
banyak_data[n]=1;
}
for (i=2;i<=n;i++)
{
if(banyak_data[i])
{
for(x=i;x*i<n;x++)
{
banyak_data[x*i]=0;
}
}
}
for (i=2;i<=n;i++)
{
if(banyak_data[i])
{
printf(“%d,”,i);
}
}
}
The output on below
Okay
The next one will post a.s.a.p
Okay nice to see you
Wassalamualaikum wr.wb
Recent Comments