# data[].attributes.body
Các bạn lập trình sơ đồ khối sau:

# data[].attributes.body
Các bạn copy nội dung file nhạc mình đã chuẩn bị vào đây.

# data[].attributes.body
Phía dưới mỗi cột bài tập, có dấu + để các bạn nhấn vào, copy nội dung bài mình đã hoàn thành vào đấy.
Phần title điền họ tên của mình.

# data[].attributes.body
Sử dụng bài tập 2 để thực hiện yêu cầu sau:
- Bạn có muốn nghe nhạc không?
(Có/Không gõ 1/0)
- Bạn đang có tâm trạng thế nào?
(Vui/Bình thường/Buồn gõ 2/1/0)

# data[].attributes.body
function Elbhn
%Bai Elbhn - Trinh Cong Son
Do = sin(2*pi*262*(0:0.000125:0.4));
Re = sin(2*pi*294*(0:0.000125:0.4));
Mi = sin(2*pi*330*(0:0.000125:0.4));
Fa = sin(2*pi*349*(0:0.000125:0.4));
Sol = sin(2*pi*392*(0:0.000125:0.4));
La = sin(2*pi*440*(0:0.000125:0.4));
Si = sin(2*pi*494*(0:0.000125:0.4));
Do2 = sin(2*pi*523*(0:0.000125:0.4));
Re2 = sin(2*pi*587*(0:0.000125:0.4));
Mi2 = sin(2*pi*659*(0:0.000125:0.4));
Fa2 = sin(2*pi*698*(0:0.000125:0.4));

Dodai = sin(2*pi*262*(0:0.000125:0.7));
Redai = sin(2*pi*294*(0:0.000125:0.7));
Midai = sin(2*pi*330*(0:0.000125:0.7));
Fadai = sin(2*pi*349*(0:0.000125:0.7));
Soldai = sin(2*pi*392*(0:0.000125:0.7));
Ladai = sin(2*pi*440*(0:0.000125:0.7));
Sidai = sin(2*pi*494*(0:0.000125:0.7));
Do2dai = sin(2*pi*523*(0:0.000125:0.7));
Re2dai = sin(2*pi*587*(0:0.000125:0.7));
Mi2dai = sin(2*pi*659*(0:0.000125:0.7));
Fa2dai = sin(2*pi*698*(0:0.000125:0.7));

Dongan = sin(2*pi*262*(0:0.000125:0.2));
Rengan = sin(2*pi*294*(0:0.000125:0.2));
Mingan = sin(2*pi*330*(0:0.000125:0.2));
Fangan = sin(2*pi*349*(0:0.000125:0.2));
Solngan = sin(2*pi*392*(0:0.000125:0.2));
Langan = sin(2*pi*440*(0:0.000125:0.2));
Singan = sin(2*pi*494*(0:0.000125:0.2));
Do2ngan = sin(2*pi*523*(0:0.000125:0.2));
Re2ngan = sin(2*pi*587*(0:0.000125:0.2));
Mi2ngan = sin(2*pi*659*(0:0.000125:0.2));
Fa2ngan = sin(2*pi*698*(0:0.000125:0.2));

Danhluoi = sin(2*pi*0*(0:0.00125:0.02));
Nghi = sin(2*pi*0*(0:0.00125:1.8));
Nghingan = sin(2*pi*0*(0:0.00125:0.1));
NghiTB = sin(2*pi*0*(0:0.00125:1));
Nghidai = sin(2*pi*0*(0:0.00125:4));
Ngatdoan = sin(2*pi*0*(0:0.00125:15));
Cau1=[Do2 Nghingan Mi2 Nghingan Sol Nghingan Sol Nghingan Do2 Nghingan Sol Nghingan Midai NghiTB Re2 Nghingan Fa2 Nghingan Sol Nghingan Re2 Nghingan Fa2 Nghingan Re2 Nghingan];
Cau2=[Mi2dai NghiTB Do2 Nghingan Mi2 Nghingan Sol Nghingan Sol Nghingan Do2 Nghingan Sol Nghingan Fadai NghiTB Fa Nghingan La Nghingan Re Nghingan Re Nghingan La Nghingan Fa Nghingan];
Cau3=[Soldai NghiTB Do2 Nghingan Mi2 Nghingan Sol Nghingan Sol Nghingan Do2 Nghingan Sol Nghingan Midai NghiTB Re2 Nghingan Fa2 Nghingan Sol Nghingan Re2 Nghingan Fa2 Nghingan Re2 Nghingan];
Cau4=[Mi2dai Nghingan Do2 Nghingan Mi2 Nghingan Sol Nghingan Sol Nghingan Do2 Nghingan Sol Nghingan Fadai NghiTB Fa Nghingan La Nghingan Re Nghingan Sol Nghingan Re2 Nghingan Si Nghingan Do2dai];
h=[Cau1 Cau2 Cau3 Cau4];
sound(h)

# data[].attributes.body
function Nhactoi

Do = sin(2*pi*262*(0:0.000125:0.4));
Re = sin(2*pi*294*(0:0.000125:0.4));
Mi = sin(2*pi*330*(0:0.000125:0.4));
Fa = sin(2*pi*349*(0:0.000125:0.4));
Sol = sin(2*pi*392*(0:0.000125:0.4));
La = sin(2*pi*440*(0:0.000125:0.4));
Si = sin(2*pi*494*(0:0.000125:0.4));
Do2 = sin(2*pi*523*(0:0.000125:0.4));
Re2 = sin(2*pi*587*(0:0.000125:0.4));
Mi2 = sin(2*pi*659*(0:0.000125:0.4));
Fa2 = sin(2*pi*698*(0:0.000125:0.4));

Dodai = sin(2*pi*262*(0:0.000125:0.7));
Redai = sin(2*pi*294*(0:0.000125:0.7));
Midai = sin(2*pi*330*(0:0.000125:0.7));
Fadai = sin(2*pi*349*(0:0.000125:0.7));
Soldai = sin(2*pi*392*(0:0.000125:0.7));
Ladai = sin(2*pi*440*(0:0.000125:0.7));
Sidai = sin(2*pi*494*(0:0.000125:0.7));
Do2dai = sin(2*pi*523*(0:0.000125:0.7));
Re2dai = sin(2*pi*587*(0:0.000125:0.7));
Mi2dai = sin(2*pi*659*(0:0.000125:0.7));
Fa2dai = sin(2*pi*698*(0:0.000125:0.7));

Dongan = sin(2*pi*262*(0:0.000125:0.2));
Rengan = sin(2*pi*294*(0:0.000125:0.2));
Mingan = sin(2*pi*330*(0:0.000125:0.2));
Fangan = sin(2*pi*349*(0:0.000125:0.2));
Solngan = sin(2*pi*392*(0:0.000125:0.2));
Langan = sin(2*pi*440*(0:0.000125:0.2));
Singan = sin(2*pi*494*(0:0.000125:0.2));
Do2ngan = sin(2*pi*523*(0:0.000125:0.2));
Re2ngan = sin(2*pi*587*(0:0.000125:0.2));
Mi2ngan = sin(2*pi*659*(0:0.000125:0.2));
Fa2ngan = sin(2*pi*698*(0:0.000125:0.2));

Danhluoi = sin(2*pi*0*(0:0.00125:0.02));
Nghi = sin(2*pi*0*(0:0.00125:1.8));
Nghingan = sin(2*pi*0*(0:0.00125:0.1));
NghiTB = sin(2*pi*0*(0:0.00125:1));
Nghidai = sin(2*pi*0*(0:0.00125:4));
Ngatdoan = sin(2*pi*0*(0:0.00125:15));

cau0 = [Dongan Mi Sol Mi Dongan Nghi Dongan Re Mi Fa Sol Nghi Sol Fa Mi Re Dongan];
cau1 = [Dongan Re Mi Re Mi Fa Mi Fa Sol Nghi Sol Fa Mi Fa Mi Re Mi Re Do];

h = [cau0 cau1];
sound(h);
end

# data[].attributes.body
function Noivongtaylon
Do = sin(2*pi*262*(0:0.000125:0.4));
Re = sin(2*pi*294*(0:0.000125:0.4));
Mi = sin(2*pi*330*(0:0.000125:0.4));
Fa = sin(2*pi*349*(0:0.000125:0.4));
Sol = sin(2*pi*392*(0:0.000125:0.4));
La = sin(2*pi*440*(0:0.000125:0.4));
Si = sin(2*pi*494*(0:0.000125:0.4));
Do2 = sin(2*pi*523*(0:0.000125:0.4));
Re2 = sin(2*pi*587*(0:0.000125:0.4));
Mi2 = sin(2*pi*659*(0:0.000125:0.4));
Fa2 = sin(2*pi*698*(0:0.000125:0.4));

Dodai = sin(2*pi*262*(0:0.000125:0.7));
Redai = sin(2*pi*294*(0:0.000125:0.7));
Midai = sin(2*pi*330*(0:0.000125:0.7));
Fadai = sin(2*pi*349*(0:0.000125:0.7));
Soldai = sin(2*pi*392*(0:0.000125:0.7));
Ladai = sin(2*pi*440*(0:0.000125:0.7));
Sidai = sin(2*pi*494*(0:0.000125:0.7));
Do2dai = sin(2*pi*523*(0:0.000125:0.7));
Re2dai = sin(2*pi*587*(0:0.000125:0.7));
Mi2dai = sin(2*pi*659*(0:0.000125:0.7));
Fa2dai = sin(2*pi*698*(0:0.000125:0.7));

Dongan = sin(2*pi*262*(0:0.000125:0.2));
Rengan = sin(2*pi*294*(0:0.000125:0.2));
Mingan = sin(2*pi*330*(0:0.000125:0.2));
Fangan = sin(2*pi*349*(0:0.000125:0.2));
Solngan = sin(2*pi*392*(0:0.000125:0.2));
Langan = sin(2*pi*440*(0:0.000125:0.2));
Singan = sin(2*pi*494*(0:0.000125:0.2));
Do2ngan = sin(2*pi*523*(0:0.000125:0.2));
Re2ngan = sin(2*pi*587*(0:0.000125:0.2));
Mi2ngan = sin(2*pi*659*(0:0.000125:0.2));
Fa2ngan = sin(2*pi*698*(0:0.000125:0.2));

Danhluoi = sin(2*pi*0*(0:0.00125:0.02));
Nghi = sin(2*pi*0*(0:0.00125:1.8));
Nghingan = sin(2*pi*0*(0:0.00125:0.1));
NghiTB = sin(2*pi*0*(0:0.00125:1));
Nghidai = sin(2*pi*0*(0:0.00125:4));
Ngatdoan = sin(2*pi*0*(0:0.00125:15));

cau0 = [Mi NghiTB Si Nghingan La Nghingan Sol Nghingan Mi Nghingan Dodai Nghingan Sol Nghingan Midai Nghingan Ngatdoan];
cau1 = [Mi Nghingan Mi NghiTB Re Nghingan Mi Nghingan La Nghingan La NghiTB Fa Nghingan Si Fa Nghingan Midai];
h = [cau0 cau1];
sound(h);
end

# data[].attributes.attachment_link.readable_text
function onha
fprintf('Ban co o nha khong ? (YES-1, NO-0)\n');
n=input('');
if n==1
    fprintf('O nguyen trong nha! Cam di dau\n');
else 
    fprintf('Ve nha ngay!\n');
    fprintf('Gio da o nha chua ??? (YES-1, NO-0)\n');
    m=input('');
    while m==0
        fprintf('Ve nha ngay!\n');
        fprintf('Gio da o nha chua ??? (YES-1, NO-0)\n');
        m=input('');
    end
    fprintf('O nguyen trong nha! Cam di dau\n');
end
end
    

# data[].attributes.attachment_link.readable_text
fprintf(' Co o nha khong ?\n')
n=input(' Nhap co hay khong 0/1: \n')
if n==1 
    fprintf(' Tot, o nguyen trong nha cam di dau \n')
else
    fprintf(' Ve nha ngay \n')
    m=input('Da ve nha chua? 0/1? \n')
    while m==0 
        fprintf('Ve nha ngay \n')
        m=input('Da ve nha chua? 0/1?\n')
    end
        fprintf(' Tot, o nguyen trong nha cam di dau \n')
end

        
 
    

# data[].attributes.body
function jingerbell
Do = sin(2*pi*262*(0:0.000125:0.4));
Re = sin(2*pi*294*(0:0.000125:0.4));
Mi = sin(2*pi*330*(0:0.000125:0.4));
Fa = sin(2*pi*349*(0:0.000125:0.4));
Sol = sin(2*pi*392*(0:0.000125:0.4));
La = sin(2*pi*440*(0:0.000125:0.4));
Si = sin(2*pi*494*(0:0.000125:0.4));
Do2 = sin(2*pi*523*(0:0.000125:0.4));
Re2 = sin(2*pi*587*(0:0.000125:0.4));
Mi2 = sin(2*pi*659*(0:0.000125:0.4));
Fa2 = sin(2*pi*698*(0:0.000125:0.4));

Dodai = sin(2*pi*262*(0:0.000125:0.7));
Redai = sin(2*pi*294*(0:0.000125:0.7));
Midai = sin(2*pi*330*(0:0.000125:0.7));
Fadai = sin(2*pi*349*(0:0.000125:0.7));
Soldai = sin(2*pi*392*(0:0.000125:0.7));
Ladai = sin(2*pi*440*(0:0.000125:0.7));
Sidai = sin(2*pi*494*(0:0.000125:0.7));
Do2dai = sin(2*pi*523*(0:0.000125:0.7));
Re2dai = sin(2*pi*587*(0:0.000125:0.7));
Mi2dai = sin(2*pi*659*(0:0.000125:0.7));
Fa2dai = sin(2*pi*698*(0:0.000125:0.7));

Dongan = sin(2*pi*262*(0:0.000125:0.2));
Rengan = sin(2*pi*294*(0:0.000125:0.2));
Mingan = sin(2*pi*330*(0:0.000125:0.2));
Fangan = sin(2*pi*349*(0:0.000125:0.2));
Solngan = sin(2*pi*392*(0:0.000125:0.2));
Langan = sin(2*pi*440*(0:0.000125:0.2));
Singan = sin(2*pi*494*(0:0.000125:0.2));
Do2ngan = sin(2*pi*523*(0:0.000125:0.2));
Re2ngan = sin(2*pi*587*(0:0.000125:0.2));
Mi2ngan = sin(2*pi*659*(0:0.000125:0.2));
Fa2ngan = sin(2*pi*698*(0:0.000125:0.2));

Danhluoi = sin(2*pi*0*(0:0.00125:0.02));
Nghi = sin(2*pi*0*(0:0.00125:1.8));
Nghingan = sin(2*pi*0*(0:0.00125:0.1));
NghiTB = sin(2*pi*0*(0:0.00125:1));
Nghidai = sin(2*pi*0*(0:0.00125:4));
Ngatdoan = sin(2*pi*0*(0:0.00125:15));

cau0= [Mi Nghingan Mi Nghingan Mi Nghidai Mi Nghingan Mi Nghingan Mi Nghidai Mi Nghingan Sol Nghingan Do Nghingan Re Nghingan Mi];
cau1= [Ngatdoan];
cau2= [Sol Nghingan Sol Nghingan Fa Nghingan Re Nghingan Do];
cau3= [Fa2 Nghingan Fa2 Nghingan Fa2 Nghingan Fa2 Nghingan Fa2 Nghingan Mi Nghingan Mi Nghingan Mi Ngatdoan]
h=[cau0 cau1 cau2 cau3];
sound(h);
end

# data[].attributes.attachment_link.readable_text
%Co ve nha khong
x = input('Co o nha khong? yesss(1)/no(0):\n ');
i = 1;
if x == 0
    while (i>0)&& (i<10)
        disp('ve nha ngay')
        y = input('Gio da o nha chua?yess(1)/no(0)\n');
        if y == 0
            i = i + 1;
        else
            i = 11;
        end
    end
    disp('Tot! O nguyen trong nha, cam di dau');
else
    disp ('Tot! O nguyen trong nha, cam di dau');
end
            

# data[].attributes.body
disp('Co o nha khong, Co=1, Khong=0');
i=input('Nhap cau tra loi: ');
if (i==1)
disp('Tot.O nguyen trong nha.Cam di dau');
else
disp('Ve nha ngay');
disp('Gio da o nha chua??, Roi=1, Chua=0');
k=input('Nhap cau tra loi: ');
while k==0;
disp('Ve nha ngay');
disp('Gio da o nha chua?? , Roi=1, Chua=0');
k=input('Nhap cau tra loi: ');
end
disp('Tot.O nguyen trong nha.Cam di dau');
end

# data[].attributes.attachment_link.readable_text
fprintf('Co o nha khong?\n')
a=input(' Co (1) hay khong (0) ');
if a==1
    fprintf('Tot , o nguyen trong nha, cam di dau')
elseif a==0
    fprintf('Ve nha ngay\n')
    b=input('Gio da o nha chua?\n');
    while b==0
        fprintf('Ve nha ngay\n')
    b=input('Gio da o nha chua?\n');
    end
   fprintf('Tot , o nguyen trong nha, cam di dau')
else fprintf('Nhap sai cu phap')
end

# data[].attributes.attachment_link.readable_text

prompt = 'Co o nha khong ? [Y/N]';
str1=input(prompt,'s');
if str1=='Y' 
    fprintf('Tot, o nguyen trong nha ! Cam di dau \n');
else fprintf('Ve nha ngay');
     fprompt = 'Gio da o nha chua ? [Y/N]';
     str2=input(prompt,'s');
     while str2 == 'N' 
     fprintf('Ve nha ngay');
     fprompt = 'Gio da o nha chua ? [Y/N]';
     str2=input(prompt,'s');
     end
     fprintf('Tot, o nguyen trong nha ! Cam di dau \n');
end  




# data[].attributes.attachment_link.readable_text
h=input('Co o nha khong: (Yes-1, No-0) ');
if h==0
    disp('Ve nha ngay! ');
    k=input('Gio da ve nha chua ');
    while k==0
        disp('Ve nha ngay! ');
        k=input('Gio da ve nha chua ');
        if k==1
            disp(' Tot hay o yen');
        end;
    end
else
   disp(' Tot hay o yen');
end

# data[].attributes.body
function hoidap
fprintf('Ban co o nha khong? Co:1 Khong:0 \n')
x=input('');
if(x==1) fprintf('Tot, Tiep tuc o nha nhe\n')
else
fprintf('Quay tro lai ngay\n')
hoidap
end
end

# data[].attributes.body
n=input('Co o nha khong? 1/0(Yes/No)');
if n==1
disp('Tot, o nguyen nha cam di dau');
else if n==0
disp('Ve nha ngay!');

m=input('Gio da o nha chua? 1/0(Yes/No)');

while m==0
disp('Ve nha ngay!');
m=input('Gio da o nha chua? 1/0(Yes/No)');
end
if m==1
disp('Tot, o nguyen nha cam di dau');
end
end
end

# data[].attributes.body
Lê Khắc Hoàng

# data[].attributes.attachment_link.readable_text
fprintf('Co o nha khong?/n');
n=input('tra loi:co/khong');
if n=='co'
    fprintf('Tot. O nguyen trong nha. Cam di dau!\n')
else 
    fprintf('Ve nha ngay, gio da o nha chua\n');
    m=input('traloi:co/khong');
    while m=='khong'
        fprintf('Ve nha ngay, gio da o nha chua\n');
        m=input('traloi:co/khong');
    end
    fprintf('Tot. O nguyen trong nha. Cam di dau!\n');
end
   
        
   
        
        
    
    
    

# data[].attributes.body
fprintf(' Co o nha khong ?\n')
n=input(' Nhap co hay khong No=0/Yes=1: \n')
if n==0
fprintf(' Tot, o nguyen trong nha cam di dau \n')
else
fprintf(' Ve nha ngay \n')
m=input('Da ve nha chua? No=0/Yes=1? \n')
while m==0
fprintf('Ve nha ngay')
m=input('Gio da ve nha chua? No=0/Yes=1?');
end
fprintf(' Tot, o nguyen trong nha cam di dau')

# data[].attributes.body
function kcbv
Do = sin(2*pi*262*(0:0.000125:0.4));
Re = sin(2*pi*294*(0:0.000125:0.4));
Mi = sin(2*pi*330*(0:0.000125:0.4));
Fa = sin(2*pi*349*(0:0.000125:0.4));
Sol = sin(2*pi*392*(0:0.000125:0.4));
La = sin(2*pi*440*(0:0.000125:0.4));
Si = sin(2*pi*494*(0:0.000125:0.4));
Do2 = sin(2*pi*523*(0:0.000125:0.4));
Re2 = sin(2*pi*587*(0:0.000125:0.4));
Mi2 = sin(2*pi*659*(0:0.000125:0.4));
Fa2 = sin(2*pi*698*(0:0.000125:0.4));

Dodai = sin(2*pi*262*(0:0.000125:0.7));
Redai = sin(2*pi*294*(0:0.000125:0.7));
Midai = sin(2*pi*330*(0:0.000125:0.7));
Fadai = sin(2*pi*349*(0:0.000125:0.7));
Soldai = sin(2*pi*392*(0:0.000125:0.7));
Ladai = sin(2*pi*440*(0:0.000125:0.7));
Sidai = sin(2*pi*494*(0:0.000125:0.7));
Do2dai = sin(2*pi*523*(0:0.000125:0.7));
Re2dai = sin(2*pi*587*(0:0.000125:0.7));
Mi2dai = sin(2*pi*659*(0:0.000125:0.7));
Fa2dai = sin(2*pi*698*(0:0.000125:0.7));

Dongan = sin(2*pi*262*(0:0.000125:0.2));
Rengan = sin(2*pi*294*(0:0.000125:0.2));
Mingan = sin(2*pi*330*(0:0.000125:0.2));
Fangan = sin(2*pi*349*(0:0.000125:0.2));
Solngan = sin(2*pi*392*(0:0.000125:0.2));
Langan = sin(2*pi*440*(0:0.000125:0.2));
Singan = sin(2*pi*494*(0:0.000125:0.2));
Do2ngan = sin(2*pi*523*(0:0.000125:0.2));
Re2ngan = sin(2*pi*587*(0:0.000125:0.2));
Mi2ngan = sin(2*pi*659*(0:0.000125:0.2));
Fa2ngan = sin(2*pi*698*(0:0.000125:0.2));

Danhluoi = sin(2*pi*0*(0:0.00125:0.02));
Nghi = sin(2*pi*0*(0:0.00125:1.8));
Nghingan = sin(2*pi*0*(0:0.00125:0.1));
NghiTB = sin(2*pi*0*(0:0.00125:1));
Nghidai = sin(2*pi*0*(0:0.00125:4));
Ngatdoan = sin(2*pi*0*(0:0.00125:15));

cau0 = [Fa Sol La Fa Fa Sol La Fa Nghingan];
cau1 = [La Si Do2dai NghiTB La Si Do2dai];
cau2 = [Do2ngan Re2ngan Do2ngan Singan La Fa Do2ngan Re2ngan Do2ngan Singan La Fa];
cau3 = [Fa Do Fadai NghiTB Fa Do Fadai];
h = [cau0 cau1 cau2 cau3];
sound(h);
end

# data[].attributes.attachment_link.readable_text
n=input('Co o nha khong? (Yes=1/No=0)');
if n==1
    disp('Tot. O nguyen trong nha! Cam di dau');
elseif n==0
    disp('Ve nha ngay\n');
    s2=input('Gio da o nha chua? (Yes/No)');
    while s2==0
        disp('Ve nha ngay\n');
        s2=input('Gio da o nha chua? (Yes/No)');
    end
    disp('Tot. O nguyen trong nha! Cam di dau');
else
    disp('Khong hop le\n');
end

# data[].attributes.body
function onha
fprintf('co o nha khong? (yes-1/no-0)\n');
a=input('');
if(a==1)
fprintf('Tot o nguyen trong nha cam di dau\n');
end;
if(a==0)
fprintf('ve nha ngay');
fprintf('Gio da o nha chua? (yes-1/no-0)\n');
b=input('');
while(b==0)
fprintf('ve nha ngay\n');
fprintf('Gio da o nha chua? (yes-1/no-0)\n');
b=input('');
end
fprintf('Tot o nguyen trong nha cam di dau\n');
end;

# data[].attributes.body
function venha
disp('Co o nha khong?');
s=input('Tra loi(yes/no):','s');
if s=="yes"
disp('Tot. O nguyen trong nha. Cam di dau!')
else
disp('Ve nha ngay!');
disp('Da ve nha chua?');
s=input('Tra loi(yes/no):','s')
while s=="no"
disp('Ve nha ngay!');
disp('Da ve nha chua?');
s=input('Tra loi(yes/no):','s');
end
end
end

# data[].attributes.attachment_link.readable_text
function stayhome;
disp('Ban co o nha khong ? (YES-1, NO-0)');
n=input('');
if n==1
    fprintf('Tot,O nguyen trong nha! Cam di dau \n');
else 
    fprintf('Ve nha ngay!\n');
    disp('Gio da o nha chua ? (YES-1, NO-0)');
    m=input('');
    while m==0
        fprintf('Ve nha ngay!\n');
        disp('Gio da o nha chua ??? (YES-1, NO-0)');
        m=input('');
    end
    fprintf('Tot,O nguyen trong nha! Cam di dau\n');
end
end
    
    


# data[].attributes.body
function stayhome
fprintf('Co o nha khong?\n1-Co, 0-Khong\n');
a=input('');
if a==1
fprintf('Tot. O nguyen trong nha, cam di dau');
else
fprintf('Ve nha ngay\n');
fprintf('Gio da o nha chua?\n1-Co, 0-Khong\n');
b=input('');
while b==0
fprintf('Ve nha ngay');
fprintf('Gio da o nha chua?\n1-Co, 0-Khong');
b=input('');
end
fprintf('Good. Cam di dau');

end

# data[].attributes.attachment_link.readable_text
b=1;
fprintf(' Co o nha khong ? ( 1= Yes; 0=No)\n')
a= input('');
if a==1
    fprintf(' Tot. O nguyen trong nha, cam di dau!\n')
else
    while b==1
    fprintf(' Ve nha ngay\n')
    fprintf(' Gio da o nha chua?( 1= Yes; 0=No)\n')
    c= input('');
    if c==1
       fprintf(' Tot. O nguyen trong nha, cam di dau!\n')
       b=0;
    end
    end
end
    
    

# data[].attributes.attachment_link.readable_text
function onhahaykhong
disp('Co o nha khong?');
a=input('Nhap cau tra loi: yes-1/no-0\n');
if a==0
    disp('Ve nha ngay!');
    b=input('Gio da o nha chua? yes-1/no-0\n');
      while b==0
          disp('Ve nha ngay!');
          b=input('Gio da o nha chua? yes/no\n');
      end
      disp('O nguyen trong nha! Cam di dau');
else
       disp('O nguyen trong nha! Cam di dau');
end
end
       

# data[].attributes.body
fprintf(' Ban co dang o nha khong ?\n')
traloi = input(' Nhap co hay khong 0/1: \n')
if traloi==1
fprintf(' Tot, o nguyen trong nha cam di dau \n')
else
fprintf(' Ve nha ngay \n')
traloi=input('Da ve nha chua? 0/1? \n')
while traloi==0
fprintf('Ve nha ngay \n')
traloi=input('Da ve nha chua? 0/1?\n')
end
fprintf(' Tot, o nguyen trong nha cam di dau \n')
end

# data[].attributes.attachment_link.readable_text
fprintf('Co o nha khong?/n');
n=input('tra loi:co/khong');
if n=='co'
    fprintf('Tot. O nguyen trong nha. Cam di dau!\n')
else 
    fprintf('Ve nha ngay, gio da o nha chua\n');
    m=input('traloi:co/khong');
    while m=='khong'
        fprintf('Ve nha ngay, gio da o nha chua\n');
        m=input('traloi:co/khong');
    end
    fprintf('Tot. O nguyen trong nha. Cam di dau!\n');
end
   
        
   
        
        
    
    
    

# data[].attributes.body
fprintf('Co o nha khong ?\n')
a=input('YESSS-1  NO-0: \n')
if a==1
fprintf('Tot, o nguyen trong nha cam di dau \n')
else
fprintf('Ve nha ngay \n')
b=input('Da ve nha chua? YESSS-1  NO-0?\n')
while b==0
fprintf('Ve nha ngay \n')
b=input('Da ve nha chua? YESSS-1  NO-0?\n')
end
fprintf('Tot, o nguyen trong nha cam di dau \n')
end

# data[].attributes.attachment_link.readable_text
fprintf('Co o nha khong?/n');
n=input('tra loi:co/khong');
if n=='co'
    fprintf('Tot. O nguyen trong nha. Cam di dau!\n')
else 
    fprintf('Ve nha ngay, gio da o nha chua\n');
    m=input('traloi:co/khong');
    while m=='khong'
        fprintf('Ve nha ngay, gio da o nha chua\n');
        m=input('traloi:co/khong');
    end
    fprintf('Tot. O nguyen trong nha. Cam di dau!\n');
end
   
        
   
        
        
    
    
    

# data[].attributes.body
function onha
fprintf('\n Co o nha khong??')
fprintf('\n Có là 1, không là 0')
x=input('\n Tra loi: ');
if x==1;fprintf(' \nHay o nguyen o nha')
else fprintf('\n Hay ve nha ngay')
fprintf('\n O nha chua')
y=input('\n Tra loi: ');
while y==0 fprintf('\n V? nhà ngay')
fprintf('\n Da o nha chua')
y=input('\n Tra loi');

end
fprintf('\n Hay o nguyen o nha')
end

# data[].attributes.body
Hoàng Kim Tuấn

# data[].attributes.attachment_link.readable_text
function hayonha;
fprintf('ban da o nha chua\n')
fprintf('roi=1, chua=0\n')
n=input('');
if n==1
    fprintf('tot o nguyen tai do\n')
else
    fprintf('ve nha ngay\n')
    fprintf('dang o dau roi\n')
    fprintf('o nha=1, chua o nha=0\n')
    m=input('');
    while m==0
    fprintf('ve nha ngay\n')
    fprintf('dang o dau roi\n')
    fprintf('o nha=1, chua o nha=0\n')
    m=input('');
    end
    fprintf('tot o nguyen tai do\n')
end


# data[].attributes.attachment_link.readable_text
function hayonha
fprintf(' Ban co dang o nha khong? \n');
fprintf(' Neu co hay dien 1, con khong thi dien 0 \n');
n=input('');
if n==1 
    fprintf(' Tot lam, o yen di ra ngoai bi Co Vy bat day \n');
else
    fprintf(' Chay ve nha ngay di, khan truong \n');
    fprintf(' Hien gio da ve nha chua \n');
    fprintf(' O nha roi thi bam 1, con chua bam 0 \n');
    m=input('');
    while m==0
        fprintf('Chay ve nha ngay di, khan truong \n');
        fprintf(' Hien gio da ve nha chua \n');
    fprintf(' O nha roi thi bam 1, con chua bam 0 \n');
    m=input('');
    end
    fprintf(' Tot lam, o yen di ra ngoai bi Co Vy bat day \n');
end

# data[].attributes.attachment_link.readable_text
fprintf('Co o nha khong?/n');
n=input('tra loi:co/khong');
if n=='co'
    fprintf('Tot. O nguyen trong nha. Cam di dau!\n')
else 
    fprintf('Ve nha ngay, gio da o nha chua\n');
    m=input('traloi:co/khong');
    while m=='khong'
        fprintf('Ve nha ngay, gio da o nha chua\n');
        m=input('traloi:co/khong');
    end
    fprintf('Tot. O nguyen trong nha. Cam di dau!\n');
end
   
        
   
        
        
    
    
    

# data[].attributes.body
a=input('co o nha khong, co=1, khong=0\n');
if a==1
fprintf('tot, o yen o nha, cam di dau\n');
else
fprintf('ve nha ngay\n');
b=0;
while b==0
b=input('da ve nha chua, co=1, khong=0\n');
end
fprintf('tot, o yen o nha, cam di dau\n');
end

# data[].attributes.body
function hoi
%UNTITLED2 Summary of this function goes here
%   Detailed explanation goes here
fprintf('co o nha khong? (yesss=1,no=0)\n');
a=input('tra loi\n')
if (a==1)
fprintf('Tot,o nguyen trong nha, cam di dau!\n');
else fprintf('Ve nha ngay!\n');
fprintf('Gio da ve nha chua?(yesss=1,no=0)\n');
b=input('tra loi');
while b==0
fprintf('Ve nha ngay!\n');
fprintf('Gio da ve nha chua?(yesss=1,no=0)\n');
b=input('tra loi')
end
fprintf('Tot,o nguyen trong nha, cam di dau!\n');
end

# data[].attributes.body
Nguyen Quang Vinh

# data[].attributes.attachment_link.readable_text
function nguoimekhotinh
fprintf('co o nha khong? co la 1 khong la 0 \n')
traloi=input('')
if traloi==1
    fprintf('tot , o nguyen trong nha cam di dau \n')
else fprintf('ve nha ngay , tao dap chet me may gio \n')
    fprintf('o nha chua?roi la 1 chua la 0 \n')
    traloitiep=input('')
    while traloitiep==0
        fprintf('o nha chua \n')
    traloitiep=input('')
    end
    fprintf('tot , o nguyen trong nha cam di dau \n')
end
end


# data[].attributes.body
function venhachua
fprintf("\n Ban co dang o nha khong?")
traloi = input('co/ khong \n')
if(traloi == 1)
fprintf("\n Tot hay ơ yen tai nha \n")
end
if(traloi == 0)
fprintf("Ve nha ngay")
venhachua
en

# data[].attributes.body
function venha
disp('Co o nha khong?');
s=input('Tra loi(yes/no):','s');
if s=="yes"
disp('Tot. O nguyen trong nha. Cam di dau!');
else
disp('Ve nha ngay!');
disp('Da ve nha chua?');
s=input('Tra loi(yes/no):','s');
while s=="no"
disp('Ve nha ngay!');
disp('Da ve nha chua?');
s=input('Tra loi(yes/no):','s');
end
disp('Tot. O nguyen trong nha. Cam di dau!');
end
end

# data[].attributes.body
function vn
fprintf(' Co o nha khong ? \n');
fprintf(' Nhap yes= 1 or no= 0 \n');
x=input('x= ');
if x==1
fprintf('\n Tot. O nguyen trong nha! Cam di dau \n');
else
fprintf('Ve nha ngay \n');
y=input('Gio da o nha chua: \n');
while y==0
fprintf('Ve nha ngay \n')
y=input(' ');
end
fprintf(' O trong nha cam di dau \n');
end

# data[].attributes.body
function  onha
disp('Co o nha khong, khong nhap 0, co thi nhap bat ky khac 0')
qs=input('');
if qs==0
while qs==0
disp('ve nha ngay')
disp('da o nha chua')
qs=input('');
end
disp('tot hay o nguyen trong nha cam di dau')
else
disp('tot hay o nguyen trong nha cam di dau')
end
end

# data[].attributes.attachment_link.readable_text
n=input('Ban co muon nghe nhac khong ? 1/0 (Co/Khong) \n');
if n==0 
    fprintf('Khong nghe thi thoi :( \n')
else
    Laxanh
    m=input('Ban dang cam thay the nao? 2/1/0 (Vui/Binh thuong/Buon) \n');
    if m==2
    fprintf('Vui \n')
    Laxanh1(0.5)
    end
    if m==1
        fprintf('Binh thuong \n')
        Laxanh
    end
    if m==0
        fprintf('Buon \n')
        Laxanh1(2)
    end
end

# data[].attributes.body
function You
Do = sin(2*pi*262*(0:0.000125:0.4));
Re = sin(2*pi*294*(0:0.000125:0.4));
Mi = sin(2*pi*330*(0:0.000125:0.4));
Fa = sin(2*pi*349*(0:0.000125:0.4));
Sol = sin(2*pi*392*(0:0.000125:0.4));
La = sin(2*pi*440*(0:0.000125:0.4));
Si = sin(2*pi*494*(0:0.000125:0.4));
Do2 = sin(2*pi*523*(0:0.000125:0.4));
Re2 = sin(2*pi*587*(0:0.000125:0.4));
Mi2 = sin(2*pi*659*(0:0.000125:0.4));
Fa2 = sin(2*pi*698*(0:0.000125:0.4));

Dodai = sin(2*pi*262*(0:0.000125:0.7));
Redai = sin(2*pi*294*(0:0.000125:0.7));
Midai = sin(2*pi*330*(0:0.000125:0.7));
Fadai = sin(2*pi*349*(0:0.000125:0.7));
Soldai = sin(2*pi*392*(0:0.000125:0.7));
Ladai = sin(2*pi*440*(0:0.000125:0.7));
Sidai = sin(2*pi*494*(0:0.000125:0.7));
Do2dai = sin(2*pi*523*(0:0.000125:0.7));
Re2dai = sin(2*pi*587*(0:0.000125:0.7));
Mi2dai = sin(2*pi*659*(0:0.000125:0.7));
Fa2dai = sin(2*pi*698*(0:0.000125:0.7));

Dongan = sin(2*pi*262*(0:0.000125:0.2));
Rengan = sin(2*pi*294*(0:0.000125:0.2));
Mingan = sin(2*pi*330*(0:0.000125:0.2));
Fangan = sin(2*pi*349*(0:0.000125:0.2));
Solngan = sin(2*pi*392*(0:0.000125:0.2));
Langan = sin(2*pi*440*(0:0.000125:0.2));
Singan = sin(2*pi*494*(0:0.000125:0.2));
Do2ngan = sin(2*pi*523*(0:0.000125:0.2));
Re2ngan = sin(2*pi*587*(0:0.000125:0.2));
Mi2ngan = sin(2*pi*659*(0:0.000125:0.2));
Fa2ngan = sin(2*pi*698*(0:0.000125:0.2));

Danhluoi = sin(2*pi*0*(0:0.00125:0.02));
Nghi = sin(2*pi*0*(0:0.00125:1.8));
Nghingan = sin(2*pi*0*(0:0.00125:0.1));
NghiTB = sin(2*pi*0*(0:0.00125:1));
Nghidai = sin(2*pi*0*(0:0.00125:4));
Ngatdoan = sin(2*pi*0*(0:0.00125:15));
cau0=[Mi Nghingan Fa Nghingan Sol Nghingan La Nghingan Si Nghidai];
cau1=[Do2 Nghingan Mi Nghingan Fa Nghingan Sol Nghingan Nghingan Nghidai];
cau2=[Do Nghingan La Nghingan Sol Nghingan Do2 Nghingan Sol Nghingan Do Nghidai];
cau3=[Fa Nghingan Do Nghingan Re Nghingan Mi Nghidai];
h=[cau0 cau1 cau2 cau3];
sound(h);
end

# data[].attributes.attachment_link.readable_text
s=input('Ban co muon nghe nhac khong? (1-Co 0-Khong)\n');
if (s==0) disp('Ok cam on ban!');
elseif(s==1)
a=input('Ban dang co tam trang the nao? (Vui/Binhthuong/Buon go 2/1/0)\n');
 if (a==2) Quocca(1/2);
 elseif(a==1) Quocca(1);
 elseif(a==0) Quocca(2);
 end
end

# data[].attributes.body
function backimthang

Do = sin(2*pi*262*(0:0.000125:0.4));
Re = sin(2*pi*294*(0:0.000125:0.4));
Mi = sin(2*pi*330*(0:0.000125:0.4));
Fa = sin(2*pi*349*(0:0.000125:0.4));
Sol = sin(2*pi*392*(0:0.000125:0.4));
La = sin(2*pi*440*(0:0.000125:0.4));
Si = sin(2*pi*494*(0:0.000125:0.4));
Do2 = sin(2*pi*523*(0:0.000125:0.4));
Re2 = sin(2*pi*587*(0:0.000125:0.4));
Mi2 = sin(2*pi*659*(0:0.000125:0.4));
Fa2 = sin(2*pi*698*(0:0.000125:0.4));

Dodai = sin(2*pi*262*(0:0.000125:0.7));
Redai = sin(2*pi*294*(0:0.000125:0.7));
Midai = sin(2*pi*330*(0:0.000125:0.7));
Fadai = sin(2*pi*349*(0:0.000125:0.7));
Soldai = sin(2*pi*392*(0:0.000125:0.7));
Ladai = sin(2*pi*440*(0:0.000125:0.7));
Sidai = sin(2*pi*494*(0:0.000125:0.7));
Do2dai = sin(2*pi*523*(0:0.000125:0.7));
Re2dai = sin(2*pi*587*(0:0.000125:0.7));
Mi2dai = sin(2*pi*659*(0:0.000125:0.7));
Fa2dai = sin(2*pi*698*(0:0.000125:0.7));

Dongan = sin(2*pi*262*(0:0.000125:0.2));
Rengan = sin(2*pi*294*(0:0.000125:0.2));
Mingan = sin(2*pi*330*(0:0.000125:0.2));
Fangan = sin(2*pi*349*(0:0.000125:0.2));
Solngan = sin(2*pi*392*(0:0.000125:0.2));
Langan = sin(2*pi*440*(0:0.000125:0.2));
Singan = sin(2*pi*494*(0:0.000125:0.2));
Do2ngan = sin(2*pi*523*(0:0.000125:0.2));
Re2ngan = sin(2*pi*587*(0:0.000125:0.2));
Mi2ngan = sin(2*pi*659*(0:0.000125:0.2));
Fa2ngan = sin(2*pi*698*(0:0.000125:0.2));

Danhluoi = sin(2*pi*0*(0:0.00125:0.02));
Nghi = sin(2*pi*0*(0:0.00125:1.8));
Nghingan = sin(2*pi*0*(0:0.00125:0.1));
NghiTB = sin(2*pi*0*(0:0.00125:1));
Nghidai = sin(2*pi*0*(0:0.00125:4));
Ngatdoan = sin(2*pi*0*(0:0.00125:15));

cau1=[Si NghiTB La NghiTB Sol Nghidai Mi Nghingan Sol NghiTB La NghiTB Mi Nghidai Mi NghiTB Sol NghiTB Re Nghidai Re Nghingan Re NghiTB Sol NghiTB Mi Nghidai];
cau2=[Si NghiTB Si NghiTB Re Nghidai Mi Nghingan Re NghiTB Mi Nghi Si Nghidai];
cau3=[Si NghiTB Si NghiTB Si Nghidai Si Nghingan Sol NghiTB Mi NghiTB La Nghidai La NghiTB La NghiTB La Nghidai Si Nghingan Si NghiTB Sol NghiTB Re];

h=[cau1 cau2 cau3];
sound(h);

# data[].attributes.attachment_link.readable_text
function nghenhac
a=input('Ban co muon nghe nhac khong? Co-1,Khong-0\n');
if a==1
    b=input('Ban dang co tam trang the nao? Vui-2,Binhthuong-1,Buon-0\n');
    if b==2
        nhac(2)
    elseif b==1
        nhac(1)
    else
        nhac(0.5)
    end
end

# data[].attributes.attachment_link.readable_text
a=input('Ban co muon nghe nhac khong ? Co(1) Khong(0) \n');
if a==1
    b=input('Ban dang co tam trang ra sao ? Vui(2) Binhthuong(1) Buon(0) \n');
    if b==2
        bacham(0.5)
    elseif b==0
        bacham(2)
    else b==1
        bacham(1)
    end
    fprintf('Cam on ban da lang nghe')
else 
    fprintf('Khong nghe thi thoi')
end
    

# data[].attributes.body
n=input('Ban co muon nghe nhac khong ? YES-1/No-0) \n');
if n==1

m=input('Ban dang cam thay the nao? Vui-2/Binh thuong-1/Buon-0 \n');
if m==2
fprintf('Vui \n');
nhac12(1.3);
elseif m==1
fprintf('Binh thuong \n');
nhac12(m);
else
fprintf('Buon \n')
nhac12(0.8);
end
else
fprintf('Khong nghe thi thoi :( \n');
end

# data[].attributes.attachment_link.readable_text
function nghenhac
fprintf('Ban co muon nghe nhac khong \n');
fprintf(' Nhac hay lam, nghe nhe( nghe-1; khong nghe-0)\n');
n=input('');
if n==0
    fprintf(' Tiec qua, hen ban lan sau \n');
else 
    fprintf(' Ban dang cam thay nhu the nao, hay cho toi biet\n');
    fprintf(' Nhap so tuong ung: vui/binh thuong/buon-2/1/0 \n');
    m=input('');
    if m==2
        phongnha2;
    elseif m==1
            phongnha;
        else m==0
            phongnha0;
    end;
end;
end
        

# data[].attributes.body
hoang kim tuan

# data[].attributes.attachment_link.readable_text
function nghenhac
fprintf('ban muon nghe nhac khong\n')
n=input('');
if n==1
    fprintf('tam trang cua ban the nao\n')
    fprintf('2=tot, 1=binhthuong, 0=xau\n')
    m=input('');
    if m==1
        happybirthday(1);
    else if m==2
           happybirthday(0.5);
        else 
            happybirthday(2);
        end
    end
else
    printf('khong nghe thi thoi'\n)
end

# data[].attributes.attachment_link.readable_text
fprintf('Ban co muon nghe nhac happy birthday khong? (1=Yes; 0=No)\n')
a=input('');
if a==1
    fprintf('Tam trang ban the nao? (2=Vui; 1=Binh thuong; 0=Buon)\n')
    b=input('');
    if b==2
        hpbd(2/3)
    elseif b==1
        hpbd(1)
    elseif b==0 
        hpbd(1.2)
    end
end

# data[].attributes.body
Nguyen Quang Vinh

# data[].attributes.body
đây là file nhạc e chỉnh cho bài 3 ạ