program c++:
#include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
int n=1,jumlah=0,x;
float rata;
cout<<"Data ke 1:";cin>>x;
while (x>0){
jumlah+=x;
cout<<"data ke"<<n+1;cout<<":";
cin>>x;
n++;
}
rata=jumlah/(n-1);
cout<<"rata rata"<<rata;
return 0;
}
Raptor:


0 ulasan