fprintf for total sum
显示 更早的评论
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 个评论
Walter Roberson
2021-2-7
Caution: you are not changing i within the loop, so every iteration is going to be adding exactly the same thing to the total.
fushen Lee
2021-2-7
Walter Roberson
2021-2-7
Rewriting in terms of index looks better.
fushen Lee
2021-2-7
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!