how to iterate powers? example 5^5 = 5*5*5*5*5
조회 수: 1 (최근 30일)
이전 댓글 표시
%potencia
x^n==input("introducir numero");
disp(x^n)
while x^n<n
x^n=(x^n)^2
end
댓글 수: 0
답변 (1개)
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
댓글 수: 0
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!