ข้อ 2 กับ 3
https://drive.google.com/open?id=1-x9mKSKiol_a6jqLh8Md4tqLcbGJT1BO
ข้อ 4
https://drive.google.com/open?id=1aBf3b8mpAHwIJBJecuCldTEadqIbQ5GH
นายรณกร ทองนวล รหัส5810110621
Ronnakorn Thongnual
วันศุกร์ที่ 3 พฤศจิกายน พ.ศ. 2560
วันศุกร์ที่ 27 ตุลาคม พ.ศ. 2560
วันพฤหัสบดีที่ 14 กันยายน พ.ศ. 2560
วันจันทร์ที่ 11 กันยายน พ.ศ. 2560
factorial
p=input("ตัวเลขคือ");
fact=1
for k=1:p
fact = k*fact
end
printf("ค่า %d factorialเท่ากับ%d\n",p,fact)
fact=1
for k=1:p
fact = k*fact
end
printf("ค่า %d factorialเท่ากับ%d\n",p,fact)
-->exec('C:\Users\5810110621\Documents\fac2.sce', -1)
ตัวเลขคือ4
ค่า 4 factorialเท่ากับ24
if else 2
p=input("ตัวเลข");
if(p>0)
printf("\n positive")
elseif(p<0)
printf("\n negative")
else
printf("\n Zero")
end
-->exec('C:\Users\5810110621\Documents\intro2.sce', -1)
ตัวเลข20
positive
-->exec('C:\Users\5810110621\Documents\intro2.sce', -1)
ตัวเลข-5
negative
-->exec('C:\Users\5810110621\Documents\intro2.sce', -1)
ตัวเลข0
Zero
if(p>0)
printf("\n positive")
elseif(p<0)
printf("\n negative")
else
printf("\n Zero")
end
-->exec('C:\Users\5810110621\Documents\intro2.sce', -1)
ตัวเลข20
positive
-->exec('C:\Users\5810110621\Documents\intro2.sce', -1)
ตัวเลข-5
negative
-->exec('C:\Users\5810110621\Documents\intro2.sce', -1)
ตัวเลข0
Zero
if else 1
function s=signum(x)
if(x>0)
s='positive'
elseif(x<0)
s='negative'
else
s="Zero";
end
endfunction
-->signum(0)
ans =
Zero
if(x>0)
s='positive'
elseif(x<0)
s='negative'
else
s="Zero";
end
endfunction
-->signum(0)
ans =
Zero
my salary 3
p=input("เงินเดือน");
n=input("จำนวนปีที่ฝาก");
i=input("ดอกเบี้ยเงิน");
for j=1:n
f(j)=(p*12)*(1+(i/100))^j;
U=f(j);
j=j+1;
end
printf("\เงินในปีที %dเท่ากับ.%3f\n",n,U);
-->exec('C:\Users\5810110621\Documents\sci3.sce', -1)
เงินเดือน30000
จำนวนปีที่ฝาก20
ดอกเบี้ยเงิน1.25
àงินในปีที 20เท่ากับ.461533.403415
n=input("จำนวนปีที่ฝาก");
i=input("ดอกเบี้ยเงิน");
for j=1:n
f(j)=(p*12)*(1+(i/100))^j;
U=f(j);
j=j+1;
end
printf("\เงินในปีที %dเท่ากับ.%3f\n",n,U);
-->exec('C:\Users\5810110621\Documents\sci3.sce', -1)
เงินเดือน30000
จำนวนปีที่ฝาก20
ดอกเบี้ยเงิน1.25
àงินในปีที 20เท่ากับ.461533.403415
สมัครสมาชิก:
บทความ (Atom)
