Sei sulla pagina 1di 7

# 1.

berikut :

Nilai ke–1 =90
Nilai ke–2=90
Nilai ke–3=80

## Frekuensi nilai yang dimasukan adalah:

Nilai 90 = 2 siswa
Nilai 80 =1siswa
Nilai rata– rata=86.67

## 2. Buatlah algoritma,flowchart,peudocode serta program menggunakan array 3

dimensi dalam membuat tampilan 3 dimensi berbentuk benda.
1. ALGORITMAFLOWCHART:
PSEUDOCODE:

>Mulai

>Deklarasiinput[3],input1,rata

>Output“ jumlahnilaiyangdimasukan

>Inputinput1

>For(inti=1;i <=input1;i++)

>Output”Nilaike–“

>Outputi

>Output“=“

>inputinput[i]

>Endfor

>Output“nilai“

>Outputinput[2]

>Output“ 2siswa“

>Output“ nilai“

>Outputinput[3]

>Output“ 1siswa“

>rata=(input[1]+input[2]+input[3]/3

>Output“nilai rata–rata =“

>Outputrata

>Selesai
PROGRAM:

#include<iostream>

#include<iomanip>

## using namespace std;

int main()

float input[3],input1;

float rata;

## cout<<"Jumlah nilai yang dimasukan=";

cin>>input1;

for(inti=1;i<=input1;i++)

cout<<"Nilai ke-"<<i<<"=";

cin>>input[i];

## cout<<"\nFrekuensi nilai yang dimasukan adalah:"<<endl;

cout<<"Nilai"<<input[2]<<"=2 siswa"<<endl;

cout<<"Nilai"<<input[3]<<"=1 siswa"<<endl;

rata=(input[1]+input[2]+input[3])/3;

cout<<setiosflags(ios::fixed);

cout<<setprecision(2)<<"Nilai rata-rata="<<rata;

}
CONTOH SCRIPT&RUNNING:
2. ALGORITMAFLOWCHART

Mulai

## Chardata [2],[3],[6]= {“1“,“4

“,“1“,“5“,“2“,“3“}

Int i,j

Output”========================”

Output“MEMBUATARRAY3D“

Output”========================”

## for(j= 0;j<3; j++)

Output data[ i ][ j ]

Selesai
PSEUDOCODE:
>mulai
>deklarasi chardata[2],[3],[6]<={“1“,“4“, “1“,“5“,“2“, “3“}
>deklarasiinti,j
>output“=======================”
>output “MEMBUAT ARRAY3D “
>output“=======================”
>for(i=0;i<2;i++)
>for(j=0;j<3;j++)
>outputdata[ i ][ j]
>selesai

PROGRAM:
#include

<iostream>using

namespace

std;intmain()

## chardata [2][3][6] ={"1", "4 ","1 ","5 ","2 ","3"};

int

i,j;cout<<"\

n";

cout<<"==========================\n";cout<<"MEMBUA

T ARRAY 3D\n";cout<<"==========================\n";

for(i=0;i<2;i++)

for(j=0;j<3;j++)

{cout<<data[i]

[j];}cout<<"\n";

}
return0;

CONTOHSCRIPT&RUNNING: