Running Program
#include <stdio.h>
int main(){
int n,max,min;
printf("Jumlah bilangan = ");scanf("%d", &n);
int bil[n];
for(int a=1; a<=n; a++){
printf(" Bilangan ke-%d = ",a);scanf("%d", &bil[a]);
}
max = bil[1];
min = bil[1];
for(int a=1; a<=n; a++){
if(max<bil[a]){
max=bil[a];
}else{
min=bil[a];
}
}
printf("Bilangan Terbesar = %d\n",max);
printf("Bilangan Terkecil = %d\n",min);
}
Running Program
#include <stdio.h>
int main(){
int n,max,min;
printf("Jumlah bilangan = ");scanf("%d", &n);
int bil[n];
for(int a=1; a<=n; a++){
printf(" Bilangan ke-%d = ",a);scanf("%d", &bil[a]);
}
max = bil[1];
min = bil[1];
for(int a=1; a<=n; a++){
if(max<bil[a]){
max=bil[a];
}else{
min=bil[a];
}
}
printf("Bilangan Terbesar = %d\n",max);
printf("Bilangan Terkecil = %d\n",min);
}
Running Program
0 comments:
Posting Komentar