Jumat, 18 Maret 2016

program C++ while


Program sederhana c++ While

#include<iostream>
using namespace std;
main()
{ int a,i,nilai_mhs[10];
float rerata,jumlah;
cout<<" Menghitung nilai Mahasiswa : \n";
cout<<" Berapa banyak mahasiswa? "; cin>>a;
i=1;
while (i<=a) {
cout<<" masukan nilai untuk mahasiwa ke "<<i<<" : ";
cin>>nilai_mhs[i];
jumlah=jumlah+nilai_mhs[i];
i+=1;
}
rerata=jumlah/a;
cout<<"Jumlah Nilai = "<<jumlah<<"\n";
cout<<"Rerata Nilai = "<<rerata;
}

Unknown

Author & Editor

Has laoreet percipitur ad. Vide interesset in mei, no his legimus verterem. Et nostrum imperdiet appellantur usu, mnesarchum referrentur id vim.

0 komentar:

Posting Komentar