Project 1 — The Number Cruncher
Your first C# project is a console sandbox — a playful math engine that takes numbers in, transforms them, and spits out results instantly. No graphics yet. No UI. Just pure logic you can twist, bend, and break.
This is where C# starts feeling powerful: fast, structured, and surprisingly fun to manipulate.
The Number Cruncher is a console program that:
- asks the user for a number,
- runs it through a series of transformations,
- prints the results instantly,
- and loops forever until you quit.
It’s simple — but the knobs you can twist are endless.
Copy and paste this prompt into your AI assistant:
Once the AI gives you the code:
Open Visual Studio → Create a new project → Console App.
Replace everything in Program.cs with the AI’s output.
Press F5. Enter numbers. Watch the transformations happen instantly.
Now let’s twist the knobs.
These tweaks turn a simple console app into a surprisingly expressive sandbox.
{
return n * Random.Shared.NextDouble();
}
The tweak: Multiply by a random number between 1 and 100 instead.
{
return 1.0 / n;
}
Then print it in the main loop. You just expanded the engine.
You’ve created a math synthesizer — one knob changes everything downstream.
Without memorizing anything, you picked up:
- Console I/O: Reading and writing text in a loop.
- Method structure: Each transformation lives in its own method.
- Types: C# requires you to specify
int,double,string, etc. - Randomness: Using
Random.Sharedto generate unpredictable behavior. - Play‑First debugging: Change a number → run → observe → tweak.