DEV C++ Menghitung Nilai UTS UAS FINAL

Ini adalah syntax program c++ untuk menghitung nilai dan rata-rata niali UTS, UAS, FINAL

 

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

float UTS[6],UAS[6],FINAL[6],tot,rata;
int i;
main()
{
i=1;
tot=0;
while(i<=5)
{
cout<<“Mahasiswa ke “<<i<<“\n”;
cout<<“UTS ke [“<<i<<“]=”;
cin>>UTS[i];
cout<<“UAS ke [“<<i<<“]=”;
cin>>UAS[i];
FINAL[i]=(0.4*UTS[i])+(0.6*UAS[i]);
tot=tot+FINAL[i];
i=i+1;
}
cout<<“\n”;
i=1;
while(i<=5)
{
cout<<“Mahasiswa ke “<<i<<“\n”;
cout<<“UTS ke [“<<i<<“]=”<<UTS[i]<<“\n”;
cout<<“UAS ke [“<<i<<“]=”<<UAS[i]<<“\n”;
cout<<“FINAL ke [“<<i<<“]=”<<FINAL[i]<<“\n\n”;
i=i+1;
}
rata=tot/(i-1);
cout<<“Rata-rata final semua mahasiswa=”<<rata;
getch();
}

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: