In below we write the matlab puzzle program for you. In this program to Find your guess Number between (1 - 21). Just copy the code then goto matlab command prompt then paste it.Then program run.You must like it.Program as below
Program
clc
clear all
close all
warning off
val = randperm(21);
display('Guess Any Number Between (1 - 21)');
reshape_val = reshape(val,7,3);
display(num2str(reshape_val))
for i = 1:3
in1 = input('Which column position of your Guessed Number : ');
if in1==1
re_order = [reshape_val(:,2)' reshape_val(:,1)' reshape_val(:,3)'];
elseif in1==3
re_order = [reshape_val(:,1)' reshape_val(:,3)' reshape_val(:,2)'];
else
re_order = [reshape_val(:,1)' reshape_val(:,2)' reshape_val(:,3)'];
end
reshape_val = reshape(re_order,3,7)';
display(num2str(reshape_val));
end
display([' Your Guess Number is :' num2str(reshape_val(11))]);
Output Screen as follows..
No comments:
Post a Comment