Results 1 to 2 of 2
Thread: Matlab
Hybrid View
-
8th December 2011 12:43 #1Registered User
Join Date: Feb:2011
Location:
Posts: 54
Matlab
Matlab, .
k=input ( ' k= ');
n=input ( ' - n= ') ;
V=input ( ' [ , , , . . .] ');
V
if k>0
for i=1:n
if V(i)<k&V(i)>0
NV(i)=V(i)+i+k;
end
if V(i)<0
NV(i)=V(i) *k;
end
end
else
for i=1:n
if V (i)>k&V(i)<0
NV(i)=V(i) *k;
end
if V(i)<k
NV(i)=V(i)+i+k;
end
end
end
NV
br=0;
for i=1:length(NV)
if NV(i)<=-5 | NV(i)>=2 | NV(i)~=0
br=br+1;
end
end
disp([ ' = ' ,num2str(br)]);
-
8th December 2011 13:22 #2




Reply With Quote

Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in