Mencari nilai akhir mahasiswa dalam bahasa C

Selamat siang semuanya,
pada kesempatan kali ini saya akan membahas masalah bagaimana mencari nilai akhir untuk mahasiswa dalam bahasa pemrograman c.

Sebelumnya kita bahas terlebih dahulu Algoritmanya agar nantinya mudah untuk di implementasikan kedalam bahasa pemrograman.

berikut adalah Algoritmanya : 
Algoritma
Deklarasi
             Mata_kuliah :integer             Nim:integer            Nama:char            Tugas,mid,uas,NA:integer            Nilai:arry[1..100]of real Deskripsi
            Read(nama)            Read(nim)            Read(mata_kuliah)            For i←0 to mata_kuliah do            Read(mata_kuliah)            Read(tugas)            Read(uts)            Read(uas)            Nilaiakhir((0.25*tugas)+(0.35*mid)+(0.4*uas))
            Write(“hasil nilai akhir anda” + NA)            Write(“nama”)            Write(“NIM”)             For i←0 to mata_kuliah do            If (arrynilai[l]>85)            Write(“A”)            Elseif (arrynilai[l]<=84&&arrynilai[l]>=75)            Write(”B”)            Elseif (arrynilai[l[<=74&&arrynilai[l]>=65)            Write(“C”)            Elseif (arrynilai[l]<=64&&arrynilai[l]>=45)            Write(“D”)            Else(arrynilai[l]<44)            Write(“E”)            endif
           

Setelah kita dapatkan Algoritmanya langsung saja kita Implementasikan ke dalam bahasa pemrograman C. 

coding #include<stdio.h>#include<conio.h>#include<stdlib.h>  int main(){                int NIM,k,l;                float tugas,mid,uas,NA;                char nama[100];                char mata_kuliah[10][10];                float arrynilai[100];                //char arrymt[100];     printf("\t\t Data Mahasiswa \n");    printf("\n\n");                printf("Masukkan Nama anda : ");                gets(nama);                printf("Masukkan NIM anda: ");                scanf("%d",&NIM);                printf("Masukkan Jumlah Mata Kuliah : ");                scanf("%d",&k);                printf("\n\n");                for(l=0;l<k;l++)                {                                printf("\n\nMasukkan nama matakuliah\n");                                printf("%d.",l+1);                                scanf("%s",&mata_kuliah[l]);                                printf("Masukkan nilai tugas : ");                                scanf("%f",&tugas);                                printf("Masukkan nilai mid : ");                                scanf("%f",&mid);                                printf("Masukkan nilai uas : ");                                scanf("%f",&uas);                                NA=(0.25*tugas)+(0.35*mid)+(0.4*uas);                                arrynilai[l]=NA;                }                                printf("\n\n\n");                                 printf("Hasil ailai akhir anda \n\n");                                printf("Nama\t:%s\n",nama);                                printf("NIM\t:%d\n",NIM);                                printf("==================================================\n");                                printf("\n\n");                                printf("No");                                printf("\tMata kuliah");                                printf("\t\tNilai\n");                                printf("==================================================\n");                                printf("\n\n");                 for(l=0;l<k;l++)                {                                printf("%d",l+1);                                printf("\t%s",mata_kuliah[l]);                                                                if(arrynilai[l]>85){                                                                printf("\t\t\tA\n");                                                                }                                                                else if(arrynilai[l]<=84&&arrynilai[l]>=75){                                                                                printf("\t\t\tB\n");                                                                }                                                                else if(arrynilai[l]<=74&&arrynilai[l]>=65){                                                                                printf("\t\t\tC\n");                                                                }                                                                else if(arrynilai[l]<=65&&arrynilai[l]>=45){                                                                                printf("\t\t\tD\n");                                                                }                                                                else{                                                                                printf("\t\t\tE\n");                                                                }                 }                                printf("==================================================\n");                                 getch();                                return 0;}


Berikut ini adalah screenshot hasil yang kita dapatkan :


Demikianlah pembahasan bagaimana caranya mencari nilai akhir untuk mahasiswa dalam bahasa C.

Subscribe to receive free email updates:

0 Response to "Mencari nilai akhir mahasiswa dalam bahasa C"

Post a Comment