开发者

Programing Logic question

开发者 https://www.devze.com 2023-03-26 15:44 出处:网络
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.
  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

精彩评论

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