PROGRAM MENCARI NILAI RATA-RATA
00.55
By
Unknown
KASUS 4
0
komentar
mencari nilai rata-rata "
#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 i,n,jumlah,x;
float rata;
cout<<"banyak data :";cin>>n;
jumlah=0;
for(i=1;i<=n;i++){
cout<<"data ke :"<<i;cin>>x;
jumlah+=x;
}
rata=(float)jumlah/n;
cout<<"rata-rata"<<rata;
return 0;
}
RAPTOR :
#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 i,n,jumlah,x;
float rata;
cout<<"banyak data :";cin>>n;
jumlah=0;
for(i=1;i<=n;i++){
cout<<"data ke :"<<i;cin>>x;
jumlah+=x;
}
rata=(float)jumlah/n;
cout<<"rata-rata"<<rata;
return 0;
}
RAPTOR :
0 komentar: