Anda di halaman 1dari 6

# Mata Kuliah : Algoritma Dasar

## Nama : Dhita Purnama Dasrul

Nrp : 152019018

3. Pseudo code
A : [[1 for a in range(100)]for b in range(100)]
a : int(input("jumlah kolom a = "))
b : int(input("jumlah baris b = "))
B,baris ,kolom ,temp ,big : integer

## for a in range(1,a+1,1): #input array

for b in range(1,b+1,1):
print("array A[",a,",",b,"]",end=" ")
A[a][b] = str(input())

## for a in range(1,a+1,1): #print array

for b in range(1,b+1,1):
print(" ")

## for a in range(1,a+1,1): #perhitungan huruf dan print

for b in range(1,b+1,1):
B=0
if A[a][b] != " ":
for k in range(len(A[a][b])):
B=B+1
if B > temp:
temp = B
baris = a
kolom = b
print(" baris ke-", baris,"kolom ke-",kolom, " lebar kata terpanjang yaitu", temp,"huruf")
flowchart
4. Pseudo code
Program NO_4
Deklarasi:
x,y,nbaris,nkolom,banyak: integer
Algoritma
banyak <-- 0
for x <-- 1 to 3 do
for y <-- 1 to 3 do
if A[x,y] == "a" or "A" then
banyak = banyak + 1
endif
endfor
endfor
print("Jumlah Kemunculan "A" adalah ",banyak ,"Kali")
flowchart
5. Pseudo code
Program NO_5
Deklarasi:
a: array[1..15,1..50] of integer
b: array[1..50,1..50] of integer
c: array[1..50,1..50] of integer
x: integer
y: integer
nbaris: integer
nkolom: integer
Algoritma
print("Masukan Elemen Matriks B")
print("Masukan Jumlah Baris = ")
input(nbaris)
print("Masukan Jumlah Kolom = ")
input(nkolom)
for i <-- 1 to nbaris do
for j <-- 1 to nkolom do
input(b[x,y])
endfor
endfor
print("Masukan Elemen Matriks C")
print("Masukan Jumlah Baris = ")
input(nbaris)
print("Masukan Jumlah Kolom = ")
input(nkolom)
for i <-- 1 to nbaris do
for y <-- 1 to nkol do
input(c[x,y])
endfor
endfor
for x <-- 1 to nbaris do
for y <-- 1 to nkolom do
a[x,y] = b[x,y] + c[x,y]
endfor
endfor
for i <-- 1 to nbaris do
for y <-- 1 to nkolom do
print("Elemen Matriks A Adalah: ",a[x,y])
endfor
endfor
6. Flowchart

### Dapatkan aplikasi gratis kami

Hak cipta © 2021 Scribd Inc.