Created
December 25, 2016 17:12
-
-
Save sonerb/b1cfecb0fb8e819afde9aeafc9e7c7a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clear, clc; | |
is_while = 1; | |
while is_while | |
sonuc = 0; | |
a = input('Bir sayı giriniz : ', 's'); | |
if strcmp(a, 'cikis') | |
break; | |
end | |
a = str2double(a); | |
a = floor(a); | |
if ~isnan(a) | |
if a == 0 | |
sonuc = 1; | |
fprintf('\nSonuç : %d\n\n', sonuc); | |
continue; | |
elseif a < 0 | |
fprintf('\nNegatif Bir Sayı Girdiniz.\n\n'); | |
continue; | |
else | |
sonuc = 1; | |
for b=1:a | |
sonuc = sonuc * b; | |
end | |
fprintf('\nSonuç : %d\n\n', sonuc); | |
continue; | |
end | |
else | |
fprintf('Lütfen sayı giriniz'); | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment