6 Array
6 Array
int main(){
char c;
scanf("%c", &c);
printf("c: %c\n", c);
return 0;
}
CHAR (3)
#include <stdio.h>
int main(){
char c;
scanf("%c", &c);
//jika scanf tidak berhenti untuk menunggu masukan
while(getchar() != '\n');
printf("c: %c\n", c);
return 0;
}
LARIK (ARRAY)
LARIK (ARRAY) (2)
MENGISI ARRAY
int main(){
int tabInt[5];
int penghitung;
for(penghitung=0; penghitung < 5; penghitung++){
tabInt[penghitung] = penghitung;
}
for(penghitung=0; penghitung < 5; penghitung++){
printf("%d ", tabInt[penghitung]);
}
return 0;
}
MENGISI ARRAY (2)
int main(){
int n;
scanf("%d", &n);
int tabInt[n];
int i;
for(i=0; i < n; i++){
scanf("%d", &tabInt[i]);
}
int main(){
int n;
scanf("%d", &n);
int tabInt[n];
int i;
for(i=0; i < n; i++){
scanf("%d", &tabInt[i]);
}