You are on page 1of 1

clear

clc

disp ('====================')
disp ('Perintah LOOPING FOR')
disp ('====================')

f = inline ('x.^2','x');
disp ('x x^2');

for x = 10:20;
fx = f (x);
disp ([num2str(x),' ',num2str(fx)]);

end

====================
Perintah LOOPING FOR
====================
x x^2
10 100
11 121
12 144
13 169
14 196
15 225
16 256
17 289
18 324
19 361
20 400

Published with MATLAB® R2013b

You might also like