LATIHAN SOAL DAN JAWABAN ARRAY DIMENSI 1 DAN 2

1.Buatlah sebuah program untuk menginputkan bilangan sebanyak 10 buah. Setelah diinput kemudian
tampilkan kembali bilangan-bilangan tersebut !



Source Code :

#include <stdio.h>
#include <conio.h>

main()

{

int j, bil[10]; //bil adalah contoh var array dimensi 1

j=0;

while (j<10)

{

printf("Input bilangan ke-%d = ",j+1);

scanf("%d",&bil[j]);

j++; //counter nilai j (j=j+1)

}

//tampilkan semua bilangan yg telah diinput

printf("\nBilanga-bilangan tersebut adalah : ");

for(j=0;j<10;j=j+1)

printf("%d ",bil[j]);

printf("\nTEKAN ENTER untuk kembali ke source code...!");

getch();

}

Comments

Popular posts from this blog

Arsitektu Angular beserta Contohnya

DOWNLOAD PUBG APK ALL VERSION BY RED EYE 2.5