Berikut ini program C++, saya menggunakan dev :
===============================================================================
#include <stdio.h>
#include <conio.h>
#define n 20
main()
{
int b,nmaks,nmin,a[n],i;
printf("Masukkan nilai maksimum 10: ");
scanf("%d",&b);
for(i=0;i<b;i++)
{
printf("Bilangan ke-%d: ",i+1);
scanf("%d",&a[i]);
}
nmin=a[0];
for(i=1;i<b;i++)
{
if(nmin>a[i])
nmin=a[i];
}
nmaks=a[0];
for(i=1;i<b;i++)
{
if(nmaks<a[i])
nmaks=a[i];
}
printf("\nNilai minimum : %d",nmin);
printf("\nNilai Maksimum : %d",nmaks);
int caridata, flag = 0;;
printf("\nMasukkan data yang ingin Anda cari : ");
scanf("%d",&caridata);
printf("hasil : %d \n",caridata);
//cari dengan metode sequential search()
for(i = 0; i<10; i++)
{
if(a[i]==caridata)
{
flag = 1;
break;
}
}
//cetak hasil
if(flag==1)
if(caridata%2==0){
printf("\n data yang anda cari adalah bilangan genap\n\n",caridata);
}else{
printf("data yang anda cari adalah bilangan ganjil\n\n",caridata);
}
else
printf("Data tidak ditemukan");
return 1;
getche();
}
=============================================================================
Good LUCK :)
Merkur-Merkur-Merkur (Merkur-Merkur-Merkur) | COVID-19
BalasHapusMerkur-Merkur-Merkur - The Merkur-Merkur-Merkur Safety Razor (also known 샌즈카지노 as the Merkur Solingen Shaving Merkur-Merkur Merkur Solingen Safety Razor 온카지노 (also known as 메리트 카지노 the Merkur Solingen Shaving