blob: 0b13d0d4293dde4a84010105415741ab8a230309 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
//Chapter 03: Algorithms
clc;
clear;
ar=[]
max_v=0
n=input('Enter the number of elements in the finite sequence:')
disp('Enter the elements one after the other!')
for i=1:n
ar(i)=input(' ')
end
for i=1:n
if ar(i)>max_v then
max_v=ar(i)
end
end
disp(max_v,'The largest element is:')
|