Notes![what is notes.io? What is notes.io?](/theme/images/whatisnotesio.png)
![]() ![]() Notes - notes.io |
%2 wykres funkcji sinus i cosinus jeden pod drugim
%3 iloczyn liczb nieparzystych
%4 na sumy liczb nieparzystych
%5 kalkulator
%6 kalendarz
%7 suma liczb
%8 silnia
clc
clear
n=input('podaj liczbe ');
while n<1 || n>8
disp('zła liczba')
n=input('podaj liczbe ');
end
if n==1
x=(-5:0.5:5);
y=sin(x);
x1=(-5:0.5:5);
y1=2*x1.^2+3*x1+4;
plot(x,y,'-.g',x1,y1,'--*r')
legend('sinus','parabolabeta')
text(1,1,'parabola i sinus')
ylabel('os y_beta')
xlabel('os x')
title('funkcja sinus i cosinus^(aaa)')
grid
elseif n==2
x=(-5:0.5:5);
y=sin(x);
x1=(-5:0.5:5);
y1=cos(x1);
subplot(2,1,1)
plot(x,y,'-.g')
legend('sinus')
text(1,1,'sinus')
ylabel('os y_beta')
xlabel('os x')
title('funkcja sinus i cosinus^{aaa}')
grid
subplot(2,1,2)
plot(x1,y1,'--*r')
legend('sinus')
text(1,1,'sinus')
ylabel('os y_beta')
xlabel('os x')
title('funkcja sinus i cosinus^(aaa)')
grid
elseif n==3
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(iloczyn2)])
elseif n==4
%suma liczb nieparzystych
i=1;
suma=0;
m=input('podaj liczbe do której ma liczyc sume liczb nieparzystych');
while i<=m
suma=suma+i;
i=i+2;
end
disp(['suma liczb nieparzystych wynosi while ',num2str(suma)])
suma2=0;
for k=1:2:m
suma2=suma2+k;
end
disp(['suma liczb nieparzystych wynosi for ',num2str(suma2)])
elseif n==5
%na if
a=input('podaj a');
b=input('podaj b');
v=input('podaj znak','s');
if v=='+'
disp(['suma wynosi(if) ', num2str(a+b)])
elseif v=='-'
disp(['różnica wynosi(if) ', num2str(a-b)])
elseif v=='*'
disp(['iloczyn wynosi(if) ', num2str(a*b)])
elseif v=='/'
disp(['iloraz wynosi(if) ', num2str(a/b)])
else
disp('zły znak(if)')
end
%na switch
switch v
case '+'
disp(['suma wynosi(switch) ', num2str(a+b)])
case '-'
disp(['różnica wynosi(switch) ', num2str(a-b)])
case '*'
disp(['iloczyn wynosi(switch) ', num2str(a*b)])
case '/'
disp(['iloraz wynosi(switch) ', num2str(a/b)])
otherwise
disp('zły znak(switch)')
end
elseif n==6
l=input('podaj numer miesiaca');
%na switch
switch l
case {1,3,5,7,8,10,12}
disp(['miesiac(switch) ', num2str(l), ' ma 31 dni'])
case {4,6,9,11}
disp(['miesiac(switch) ', num2str(l), ' ma 30 dni'])
case 2
disp(['miesiac(switch) ', num2str(l), ' ma 28 dni'])
otherwise
disp('zły numer mieiaca(switch)')
end
%na if
if l==1 || l==3 || l==5 || l==7 || l==8 || l==10 || l==12
disp(['miesiac(if) ', num2str(l), ' ma 31 dni'])
elseif l==4 || l==6 || l==6 || l==9 || l==11
disp(['miesiac(if) ', num2str(l), ' ma 30 dni'])
elseif l==2
disp(['miesiac(if) ', num2str(l), ' ma 28 dni'])
else
disp('zły numer miesiaca(if)')
end
elseif n==7
i=1;
suma=0;
m=input('podaj liczbe do której ma liczyc sume liczb ');
while i<=m
suma=suma+i;
i=i+1;
end
disp(['suma liczb wynosi(while) ',num2str(suma)])
suma2=0;
for k=1:1:m
suma2=suma2+k;
end
disp(['suma liczb wynosi(for) ',num2str(suma2)])
elseif n==8
i=1;
silnia=1;
%na while
m=input('podaj liczbe oo której ma policzyc silnie');
while i<=m
silnia=silnia*i;
i=i+1;
end
%na for
disp(['silnia(while) wynosi ',num2str(silnia)])
silnia2=1;
for k=1:1:m
silnia2=silnia2*k;
end
disp(['silnia(for) wynosi ',num2str(silnia2)])
else
disp('zła liczba')
end
![]() |
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