fprintf for total sum
8 次查看(过去 30 天)
显示 更早的评论
N = input("Enter value for N:");
total = 0;
for index=1:N
total = total +(1/index+1/((index+2)*(index+3))) ;
end
fprintf(
Question how to it fprintf the answer, i able to use display but i have not idea how to made it on fprintf?
4 个评论
采纳的回答
Ive J
2021-2-7
doc fprintf
An example for a floating point number:
X = 2.345674;
fprintf('My number is %.2f\n', X)
My number is 2.35
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!