fork download
  1. Program Nilai mahasiswa
  2. {IS : Memberikan masukan berupa nama mahasiswa dan nilai mahasiswa[format0-100]}
  3. {FS : Memberikan keluaran beruapa nilai rata-rata mahasiswa }
  4.  
  5. kamus :
  6.  
  7. Type Mahasiswa ( Nama : string
  8. Nilai : integer
  9. indeks : char
  10. )
  11. mahasiswa : mhs
  12. menu,jumlah,i,total : integer
  13. rata : real
  14.  
  15. procedure Memasukan_daftar(
  16. Output("Masukan jumlah mahasiwa :")
  17. input(jumlah)
  18. for i:=1 to jumlah do
  19. output("Nama[",i,"] :") input(mhs.nama[i])
  20. output("Nilai[",i,"]:") input(mhs.nilai[i])
  21. )
  22.  
  23. procedure menampilakan_data(
  24. for i:=1 to jumlah do
  25. output("Nama[",i,"] :", mhs.nama[i])
  26. output("Nilai[",i,"]:", mhs.nilai[i])
  27. output("Indeks[",i,"]:", mhs.indeks[i])
  28. gantibaris
  29. )
  30.  
  31. fungsi nilai_rata(I: mhs.nilai : mahasiswa) -> real
  32. {IS : Memasukan nilai mahasiswa}
  33. {FS : Mengeluarkan nilai rata2}
  34. for i:=1 to jumlah do
  35. total = total + mhs.nilai[i]
  36. rata <-total / jumlah
  37. output('Nilai rata-rata :',rata)
  38.  
  39. fungsi konversi_indeks(I: mhs.nilai : mahasiswa) -> char
  40. {IS : Memasukan nilai mahasiswa}
  41. {FS : Mengeluarkan nilai menjadi indeks}
  42. for i:=1 to jumlah do
  43. if mhs.nilai[i] =>0 and mhs.nilai[i] =< 26 then mhs.indeks <-'E'
  44. if mhs.nilai[i] =>26 and mhs.nilai[i] =< 40 then mhs.indeks <-'D'
  45. if mhs.nilai[i] =>41 and mhs.nilai[i] =< 60 then mhs.indeks <-'C'
  46. if mhs.nilai[i] =>61 and mhs.nilai[i] =< 75 then mhs.indeks <-'B'
  47. if mhs.nilai[i] =>76 and mhs.nilai[i] =< 100 then mhs.indeks <-'A'
  48.  
  49. ALGORITMA
  50.  
  51. Output('Penghitung nilai rata-rata mahasiswa')
  52. output('Menu')
  53. output('1.Masukan Nama dan Nilai')
  54. output('2.Menampilakan data')
  55. output('3.Hitung rata-rata')
  56. output('4.Konversi Indeks')
  57. output('5.Exit')
  58. output('pilihan menu :')
  59. input(menu)
  60. depend on(menu)
  61. 1 : procedure Memasukan_daftar
  62. 2 : procedure menampilkan_daftar
  63. 3 : fungsi nilai_rata(I: mhs.nilai : mahasiswa ) -> real
  64. 4 : fungsi konversi_indeks(I: mhs.nilai : mahasiswa) -> char
  65. 5 : output('EXIT')
  66.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Nilai’
prog.c:3: error: expected identifier or ‘(’ before ‘{’ token
prog.c:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token
prog.c:33: error: expected identifier or ‘(’ before ‘{’ token
prog.c:34: error: expected identifier or ‘(’ before ‘for’
prog.c:37:9: warning: character constant too long for its type
prog.c:41: error: expected identifier or ‘(’ before ‘{’ token
prog.c:42: error: expected identifier or ‘(’ before ‘for’
prog.c:51:8: warning: character constant too long for its type
prog.c:52:8: warning: multi-character character constant
prog.c:53:8: warning: character constant too long for its type
prog.c:54:8: warning: character constant too long for its type
prog.c:55:8: warning: character constant too long for its type
prog.c:56:8: warning: character constant too long for its type
prog.c:57:8: warning: character constant too long for its type
prog.c:58:8: warning: character constant too long for its type
prog.c:65:13: warning: multi-character character constant
stdout

Standard output is empty