1. Trang chủ
  2. » Giáo án - Bài giảng

Dùng đệ quy in ra dãy n bit nhị phân

1 357 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 1
Dung lượng 24 KB

Nội dung

program chuoi_n_bit; const max=250; var x:array[1 max] of byte; i:byte; n:byte; procedure inketqua; var i:byte; begin for i:=1 to n do write(x[i]:5); writeln; end; procedure chuoi(i:byte); var j:byte; begin for j:=0 to 1 do begin x[i]:=j; if i=n then inketqua else chuoi(i+1); end; end; begin {n la so bit can sinh} write('Nhap so bit can sinh: '); readln(n); chuoi(1); {luon bat dau tu 1} readln; end. . j:byte; begin for j:=0 to 1 do begin x[i]:=j; if i =n then inketqua else chuoi(i+1); end; end; begin {n la so bit can sinh} write('Nhap so bit can sinh: '); readln (n) ; chuoi(1); {luon. program chuoi _n_ bit; const max=250; var x:array[1 max] of byte; i:byte; n: byte; procedure inketqua; var i:byte; begin for i:=1 to n do write(x[i]:5); writeln; end; procedure chuoi(i:byte); var. sinh} write('Nhap so bit can sinh: '); readln (n) ; chuoi(1); {luon bat dau tu 1} readln; end.

Ngày đăng: 07/02/2015, 09:00

TỪ KHÓA LIÊN QUAN

w