Zadanie 1
Cytat: |
---|
a=input("podaj początek przedziału"); b=input("podaj koniec przedziału"); d=input("krok"); x=a:d:b; i=1; n=length(x); while i<=n y(i)=x(i)+2; i=i+1; end disp(y) |
Zadanie 4. A(2sposoby)
Cytat: |
---|
x=input("poczatek") y=input("koniec") i=x; while i<=y if (mod(i,2)==1) i endif i=i+1; end |
Cytat: |
---|
x=input("poczatek") y=input("koniec") i=x; if (mod(i,2)!=1) i=i+1; endif while i<=y i i=i+2; end |
4. B
Cytat: |
---|
v=input("podaj wektor"); i=1; sr=0; while i<=(length(v)) sr=sr+v(i); i=i+1; end sr=sr/length(v) |
4. C
Cytat: |
---|
v=input(" podaj wektor") u=input("podaj 2 wektor") i=1; il=0; while i<=(length(v)) il=il+v(i)*u(i); i=i+1; end disp(il) |
4. D
Cytat: |
---|
v=input("podaj wektor") x=input("podaj liczbe od ktorej maja byc wieksze") sum=0; i=1; while i<=(length(v)) if (v(i)>x) sum=sum+v(i); endif i=i+1; end disp(sum) |
4.E
Cytat: |
---|
a=input("podaj początek przedziału") b=input("podaj koniec przedziału") il=a; i=a; while i<b il=il*(i+1) i=i+1 end |