Menghitung Nilai Rata-rata 6 nilai

Posted: April 21, 2010 in Daspro
Tags:

#include<stdio.h>
#include<iostream.h>
#include<conio.h>

int main()
{
char nama[40], jurusan[60];
int nilai;
long int nim;
double bil1,bil2,bil3,bil4,bil5,bil6,hasil;
char ulang;
clrscr();
cout<<“============= Hitung Nilai Rata-rata dari 10 bilangan yang diinputkan ====== “<<endl;
cout<<“=======================”<<endl;
cout<<“Masukan Nama Anda    : “;cin>>nama;
cout<<“Masukan NIM Anda     : “;cin>>nim;
cout<<“Masukan Jurusan Anda : “;cin>>jurusan;
do
{
cout << “Nilai 1 : “;
cin >> bil1;
cout << “Nilai 2 : “;
cin >> bil2;
cout << “Nilai 3 : “;
cin >> bil3;
cout << “Nilai 4 : “;
cin >> bil4;
cout << “Nilai 5 : “;
cin >> bil5;
cout << “Nilai 6 : “;
cin >> bil6;
hasil = bil1+bil2+bil3+bil4+bil5+bil6;
hasil = hasil / 6 ;
cout<<endl;
cout<<endl;
cout<<“=====================================”<<endl;
cout<<“Mahasiswa dengan NIM : “<<nim<<endl;
cout<<“dengan Nama : “<<nama<<endl;
cout<<“Nilai rata-ratanya adalah : ” << hasil <<endl;
if (hasil>80)
{printf (“Huruf Mutu : A\n”);}
else if ((hasil>=70)&&(hasil<79))
{printf (“Huruf Mutu : B\n”);}
else if ((hasil>=55)&&(hasil<69))
{printf (“Huruf Mutu : C\n”);}
else if ((hasil>=40)&&(hasil<54))
{printf (“Huruf Mutu : D\n”);}
else if ((hasil>=0)&&(hasil<39))
{printf (“Huruf Mutu : E\n”);}
cout<<“=====================================”<<endl;
cout<<“Apakah anda ingin menghitung nilai rata-rata lagi y/t)?”;
cin>>ulang;
}
while(ulang==’y’);
return 0;
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s