TUYỂN TẬP 20 ĐỀ THI KHẢO SÁT HỌC SINH GIỎI MÔN TIẾNG ANH LỚP 6 NĂM 2020 (CÓ Đ...
Kelompok 2.6
1. KELOMPOK
2.6 Membuat faktorial dengan komponen Analisis.
Analisis
Inisialisasi : x 1
y 0
z 0
xy
yz
n 0
Input : bil
Perulangan
Kondisi : n >=bil
Proses : z x+y
n n+1
Output : 0, b
2. ALGORITMA
Deklarasi
bil : integer (input)
y : integer (output)
Deskripsi
read (bil)
for(i=0;i>=n)
z z+ 1
x y
y-z
in n +1
write (y)
5. Bahasa C++
#include <iostream>
#include <string>
using namespace std;
int main()
{
string raptor_prompt_variable_zzyz;
int x,y,z,bil,n;
x =1;
y =0;
z =0;
cout<<"masukan bilangan"<<endl;
cin >> bil;
n =0;
cout << 0 << endl; while (!(n>=bil))
{
z =x+y;
x =y;
y =z;
n =n+1;
cout << y << endl; }