Senin, 24 Desember 2012
TUGAS PROGRAM PASCAL
program banyak_huruf_dalam_kalimat;
uses wincrt ;
var n : array [ 1 . . 26 ] of integer ;
i , j : integer ;
kata : String ;
begin
for i : = 1 to 26 do n [ i ] : = 0 ;
write ( ' Ketikkan sebuah kalimat : ' ) ; readln ( kata ) ;
for i : = 1 to length ( kata ) do
for j : = 1 to 26 do
if ord ( upcase (kata [ i ] ) ) = 64 + j then
inc ( n [ j ] ) ;
for i : = 1 to 13 do
writeln ( chr ( 64 + 2 * i - 1 ) , ' = ' , n [ 2 * i - 1 ] , ' ' , chr ( 64 + 2 * i ) , ' =
' , n [ 2 * i ] ) ;
end .
Hasilnya adalah :
ketikkan sebuah kalimat : aku sayang martha
A = 5 B = 0
C = 0 D = 0
E = 0 F = 0
G = 1 H = 1
I = 0 J = 0
K = 1 L = 0
M = 1 N = 1
O = 0 P = 0
Q = 0 R = 1
S = 1 T = 1
U = 1 V = 0
W = 0 X = 0
Y = 1 Z = 0
Langganan:
Posting Komentar (Atom)
blognya bgaus,
BalasHapustapi lebih bagus pakai pengantar ya..., seperti artikel,
SEMANGAT....!!
ia pak makasih :)
Hapus