input sembarang bilangan
#include <iostream.h>
#include <conio.h>
#include <iomanip.h>
main()
{
int byk123,byk1,byk2,byk3,bil,bykbil,jmlbil;
byk123=byk1=byk2=byk3=bykbil=jmlbil=0;
while (byk123<10)
{
cout<<"inputkan sembarang bil : ";
cin>>bil;
bykbil++;
jmlbil+=bil;
if ((bil>=1) & (bil<=3))
{
byk123++;
if (bil==1) byk1++;
else if (bil==2) byk2++;
else byk3++;
}
}
cout<<setiosflags(ios:: showpoint)<< setw(12)<<setprecision(2);
cout<<"rata2 bil yg diinputkan : "<<jmlbil/bykbil<<endl;
cout<<"byk bil 1 : "<<byk1<<endl;
cout<<"byk bil 2 : "<<byk2<<endl;
cout<<"byk bil 3 : "<<byk3<<endl;
cout<<"byk bil lainnya : "<<bykbil-byk123<<endl;
getch();
}
Comments
Post a Comment