Paul Deitel and Harvey M. Deitel introduce console apps, which input and output text in a console window. In this chapter you'll learn to input data from the keyboard and output data to the screen, declare and use data of various types, use arithmetic operators, write decision-making statements and use relational and equality operators.

3.1. Introduction

We now introduce C# app programming. Most of the C# apps you’ll study in this book process information and display results. In this chapter, we introduce console apps—these input and output text in a console window, which in Windows is known as the Command Prompt.

We begin with several examples that simply display messages on the screen. We then demonstrate an app that obtains two numbers from a user, calculates their sum and displays the result. You’ll perform various arithmetic calculations and save the results for later use. Many apps contain logic that makes decisions—the last example in this chapter demonstrates decision-making fundamentals by comparing numbers and then displaying messages based on the comparison results. For example, the app displays a message indicating that two numbers are equal only if they have the same value.