Kamis, 06 September 2012
Pengulangan c++
#include<stdioh>
#include<conioh>
main()
{
printf("\nTugas Algoritma & Pemprograman");
printf("\nSUHARTINI");
printf("\n421 11 016");
printf("\n1A d4 Teknik Listrik");
printf("\n===========================================================\n");
printf("===========================================================\n");
int kode;
char jawab;
do
{
printf("\n Menghitung Rata-rata dan Nilai akhir dari 5 Mata Kuliah");
printf("\n===========================================================");
float MK1,MK2,MK3,MK4,MK5,rata2;
printf("\nMasukkan nilai MK Rangkaian Listrik Lanjutan : ");
scanf("%f",&MK1);
printf("Masukkan nilai MK GARTEK ; ");
scanf("%f",&MK2);
printf("Masukkan nilai MK Algoritma & Pemrograman : ");
scanf("%f",&MK3);
printf("Masukkan nilai MK Matematika Teknik : ");
scanf("%f",&MK4);
printf("Masukkan nilai MK Kewarganegaraan : ");
scanf("%f",&MK5);
rata2 = (MK1+MK2+MK3+MK4+MK5)/5;
label:
printf("\n Menu Utama");
printf("\nx=====================================x");
printf("\nx 1. Rata2 x");
printf("\nx 2. Nilai akhir x");
printf("\nx=====================================x");
printf("\nPilih(1-2) :: ");
scanf("%d",&kode);
switch(kode)
{
case 1 : printf("Jumlah rata-rata dari 5 mata kuliah = %f\n",rata2);break;
case 2 :if(rata2 >= 80&&rata2<=100)
printf("Nilai akhir = A\n");
if(rata2 >= 70&&rata2<=79)
printf("Nilai akhir = B\n");
if(rata2 >= 60&&rata2<=69)
printf("Nilai akhir = C\n");
if(rata2 >= 50&&rata2<=59)
printf("Nilai akhir = D\n");
if(rata2 <=49)
printf("Nilai akhir = E\n");
default: printf("Nomor Yang Anda Masukkan Salah, silahkan pilih ulang!!\n");goto label; break;
}
printf("Anda ingin mengulangi??? (Ya/Tidak) = ");
scanf("%s",&jawab);
}
while(jawab=='y');
}
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar