CSCI 102 - Fall 2024 Fundamentals of Computation

Week 6 Lab

Q&A on Material

Sign in to lab!

Take a look at the idioms related to basic loop (iterative) statements:

Exercises

Walk through these exercises and complete them as a group (if time allows).

Tracing

Determine the output of this program by tracing its execution manually.

#include <iostream>
#include <string>
using namespace std;

int main()
{
  int x = 0;
  int y = 1;
  while (!((x % 5 == 0) && (y % 64 == 0)))
  {
    x++;
    y *= 2; 
  }
  cout << x << " " << y << endl;
  return 0;
}

Solution

Coding

loading…
loading…
loading…
loading…

Open-ended Help

Any students with questions may stay after to get help. Please ask questions! Anyone else may leave at this stage.