필터 지우기
필터 지우기

how to iterate powers? example 5^5 = 5*5*5*5*5

조회 수: 2 (최근 30일)
Ricardo David
Ricardo David 2022년 8월 25일
답변: Chunru 2022년 8월 25일
%potencia
x^n==input("introducir numero");
disp(x^n)
while x^n<n
x^n=(x^n)^2
end

답변 (1개)

Chunru
Chunru 2022년 8월 25일
% potencia
% x=input("introducir numero");
x = 5;
n=1;
xn = 1;
while n<=5
xn = xn * x;
fprintf("x^%d = %d\n", n, xn);
n = n+1;
end
x^1 = 5 x^2 = 25 x^3 = 125 x^4 = 625 x^5 = 3125

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by