K
K
Kakeru2018-06-07 17:12:07
C++ / C#
Kakeru, 2018-06-07 17:12:07

Can anyone explain how this c++ code works?

Here is the code itself:

#include <iostream>

using namespace std;

int main() {

  int n;

  int s;

  n = 0;

  s = 0;

  while (s <= 257) {
    s = s + 10;
    n = n + 3;
  }

  cout << n <<endl;
  system("pause");
  return 0;
}

How does this cycle work?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
VoidVolker, 2018-06-07
@kakeru

And what exactly is unclear here? It says to loop while s is less than or equal to 257 .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question