#include <iostream.h> int main(){ int n; cout<<"Masukkan n : "; cin>>n; cout<<endl<<endl; int data[50]; float rata2,jumlah=0; for(int i=1;i<=n;i++){ cout<<"Masukkan data "<<i<<" : "; cin>>data[i]; if(data[i]%2==0) { //seleksi genap aje.... jumlah+=data[i]; rata2=jumlah/n; } } cout<<"\n\n\tRata-rata Genap adalah "<<jumlah<<":"<<n<<" = "<<rata2<<endl; return 0; }
0 comments:
Posting Komentar