#include<iostream.h>;
#include<conio.h>;
void main(){
char lagi='y';
int nilai=0;
int totalnilai=1;
int a=1;
float ratarata;
char nilaihuruf;
while(lagi=='y')
{
cout<<"input nilai ke "<<a<<" : ";
cin>>nilai;
a++;
totalnilai=totalnilai+nilai;
cout<<"input data lagi? [y/t] : ";
cin>>lagi;
}
cout<<"***********************************"<<endl;
cout<<"total nilai : "<<totalnilai<<endl;
ratarata=totalnilai/(a-1);
cout<<"Rata-rata = "<<ratarata<<endl;
if (ratarata>84 && ratarata<101)
nilaihuruf='A';
if(ratarata>69 && ratarata<85)
nilaihuruf='B';
if(ratarata>59 && ratarata<70)
nilaihuruf='C';
if(ratarata>45 && ratarata<59)
nilaihuruf='D';
if(ratarata<45)
nilaihuruf='E';
cout<<"Nilai Anda : "<<nilaihuruf;
getch();
}
No comments:
Post a Comment