Tuesday, 26 March 2013

Program C++ Menghitung Total nilai dan Rata-rata

 Program C++ Menghitung Total nilai dan Rata-rata
#include
#include

void main(){
int i,nilai[100],n,total;
double rata;
total =0;
cout<<"banyaknya mahasswa:";cin>>n;
for (i=1;i<=n;i++)
   {
cout<<"nilai mahasiswa ke"<>nilai[i];
total+=nilai[i]  ;
}

cout<<"total nilai mahasiswa: "<rata=total/n;
cout<<"rata-rata nilainya: "<getch();}

No comments:

Post a Comment