SOAL
Scrip Program
#include<stdio.h>
#include<conio.h>
#include<iostream.h>
main ()
{
char nama[30], nis[8];
int nilai_mds_1, nilai_s_1, nilai_mds_2, nilai_s_2, nilai_akhir;
cout<<"\t\t\tSMA SEMANGAT PAGI\n";
cout<<"\t\t\tJl.Raya pantang menyerah\n";
cout<<"\t\t========================================\n";
cout<<"Nama : ";gets(nama);
cout<<"Nis : ";cin>>nis;
cout<<endl;
cout<<"nilai mid semester 1 : ";cin>>nilai_mds_1;
cout<<"nilai semester 1 : ";cin>>nilai_s_1;
cout<<"nilai mid semester 2 : ";cin>>nilai_mds_2;
cout<<"nilai semester 2 : ";cin>>nilai_s_2;
cout<<endl;
nilai_akhir = (nilai_mds_1+nilai_s_1+nilai_mds_2+nilai_s_2)/4;
cout<<"jadi siswa yang bernama : "<<nama<<endl;
if(nilai_akhir>>80)
{
cout<<"Memperoleh Nilai akhir = "<<nilai_akhir<<endl;
cout<<"masuk ke kelas = A\n";
}
else
if(nilai_akhir>>70)
{
cout<<"Memperoleh Nilai akhir = "<<nilai_akhir<<endl;
cout<<"masuk ke kelas = B\n";
}
else
if(nilai_akhir>>60)
{
cout<<"Memperoleh Nilai akhir = "<<nilai_akhir<<endl;
cout<<"masuk ke kelas = C\n";
}
getch();
}
hasilnya
download
Tidak ada komentar:
Posting Komentar