开发者

Programing Logic question

  1. Design the logic, using a looping structure, for a program that outputs every even number from 1 through 25 along with its s开发者_StackOverflowquare and cube.

Here is my Answer please I need to know if I am on the right track FYI it is the programming Logic not the actual code. I need your help thanks

If n > 0> 25 MOD 2 = o then
  NMOD2 = 0
Else then
  NMOD2 = (0)^2
End If

If NMOD2 = 0 then
  NMOD2 = (0)^3


Um, like this?

for (int i = 1; i <= 25; i++) {
    if (i % 2 == 0) {
        cout << i << ' ' << i*i << ' ' << i*i*i << "\n\n";
    }
}

sry i dont understand your pseudocode

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜