Advertisement
lalkaed

MatLab3

Apr 19th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.27 KB | None | 0 0
  1. prompt = 'Enter numbers: ';
  2. x =  [0 0 0 0 0]
  3. for i = 1:5
  4.     x(i)  = input(prompt);
  5. end
  6.  
  7. y =[0 0 0 0 0]
  8. for j = 1:5
  9.     y(j) = randi(42)
  10. end
  11.  
  12. count = 0;
  13. for k = 1:5
  14.     if y(k) == x(k)
  15.         count = count + 1;
  16.     end
  17. end
  18. fprintf('Count = %d\n', count);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement