NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

----------------------------%program liczy sume liczb nieparzystych while i for------------------------
n=input('podaj ile wyrazów ma miec suma');
suma=0;
i=1;
while i<=n
suma=suma+i;
i=i+1;
end
disp([num2str(suma),' to ta liczba'])
suma2=0;
for m=1:1:n
suma2=suma2+m;
end
disp([num2str(suma2),' to ta liczba for'])
----------------------------------------------------------------------------------------------------%1. na pierwszy wykres prostej i parabli na jednej
%prosta i parabola na osobncyh wykresach
%suma koljenych liczb naturalnych
clc
clear
n=input('podaj numer');
switch n
case 1
subplot(1,1,1)
x=(-5:0.2:5);
a=2;
b=3;
c=5;
y=a*x+b;
y2=a*x.*x+b;
plot(x,y,'rd-',x,y2,'-.g')
xlabel('o^s _x')
ylabel('os y')
legend('prosta','parabolalpha')
text(-2,1,'pa^rabo_la')
grid
case 2
subplot(1,2,1)
x=(-2*pi:0.2:2*pi);
x2=(-2*pi:0.2:2*pi);
a=1;
b=2;
y=a*x+b;
y2=a*x.*x+b;
plot(x,y,'--*r')
xlabel('os x')
ylabel('os y')
legend('prosta')
text(-2,1,'sinus')
grid
subplot(1,2,2);
y=a*x.*x+b;
x=(-2*pi:0.2:2*pi);
plot(x,y,'--d');
legend('parabola')
text(1,2,'dwa')
grid
case 3
n=input('podaj ile liczb bedzie = ');
x=1:n;
k=1;
while k<=n
a=input('podaj liczbe= ');
x(1,k)=a;
k=k+1;
end
m=1;
wynik=0;
for m=1:n
liczba=x(1,m);
wynik=wynik+liczba;
m=m+1;
end
disp(['wynik= ',num2str(wynik)])

otherwise
disp('zla liczba')
end
-----------------------------------------%Iloczyn liczb nieparzystych while i for:----------------------------
%Iloczyn liczb nieparzystych while i for:
i=1;
iloczyn=1;
m=input('podaj liczbe do której ma liczyc iloczyn liczb nieparzystych');
while i<=m
iloczyn=iloczyn*i;
i=i+2;
end
disp(['iloczyn liczb nieparzystych wynosi while ',num2str(iloczyn)])
iloczyn2=1;
for k=1:2:m
iloczyn2=iloczyn2*k;
end
disp(['iloczyn liczb nieparzystych wynosi for ',num2str(iloczyn)])
----------------------------------------%program liczy sume liczb parzystych while i for---------------------
n=input('podaj ile wyrazów ma miec suma ');
suma=0;
i=0;
while i<=n
suma=suma+i;
i=i+2;
end
disp([num2str(suma),' to ta liczba while'])
suma2=0;
for m=0:2:n
suma2=suma2+m;
end
disp([num2str(suma2),' to ta liczba for'])
-------------------------------------%Iloczyn liczb parzystych while i for:----------------------------------
clc
clear all
i=1;
iloczyn=1;
m=input('podaj liczbe do której ma liczyc iloczyn liczb parzystych');
while i<=m
iloczyn=iloczyn*i;
i=i+2;
end
disp(['iloczyn liczb parzystych wynosi while ',num2str(iloczyn)])
iloczyn2=1;
for k=1:2:m
iloczyn2=iloczyn2*k;
end
disp(['iloczyn liczb parzystych wynosi for ',num2str(iloczyn)])

-----------------Silnia while i for---------------------------------------------------
i=1;
silnia=1;
%na while
m=input('podaj liczbe do której ma policzyc silnie');
while i<=m
silnia=silnia*i;
i=i+1;
end
%na for
disp(['silnia(for) wynosi ',num2str(silnia)])
silnia2=1;
for k=1:1:m
silnia2=silnia2*k;
end
disp(['silnia(while) wynosi ',num2str(silnia)])
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.