#include <iostream.h>
#include <conio.h>
void main(){
char jawab;
int nilai[100],i,a=0;
float total,rata;
cout<<"MENCARI RATA-RATA"<<endl;
do{
cout<<"data "<<a++<<"=" ;cin>>nilai[i];
total=total+nilai[i];
cout<<"lanjut 'Y' selesai 'T'";cin>>jawab;
if (jawab=='Y' || jawab=='y')
continue;
else (jawab=='T' || jawab=='t');{
cout<<endl;
cout<<"rata = "<<(total)/a<<endl;
}
getch();
}while(a);
}
Posting Komentar