index | submit | rank | book

Computer Science by Example

<< Preface   |   1. Introduction   |   2. Setting up what you need >>

1. Introduction

Computer Science is the study of computing, computer programs, data processing. One of the central aspects of Computer Science is computer programming, or coding, which is the process of creating computer programs. ◻

Here is an example computer program that computes the greatest common divisor (GCD) of two integer numbers:

program GCD;

function gcd(a, b: integer): integer;
begin
    if b = 0 then
        gcd := a
    else
        gcd := gcd(b, a mod b);
end;

var x, y: integer;

begin
    write('Please type two integers: ');
    read(x,y);
    writeln('Their greatest common divisor is: ', gcd(x,y));
end.

Throughout the course of this book you will be able to understand and create programs like the one above. ◻

Computer Science by Example (CScx) aims to teach Computer Science through programming exercises. Each exercise is built on top of the previous applying a new concept. After solving each of this book’s exercises, you are invited to submit your solutions to the CScx Online Judge which will automatically grade solutions so you can know if they are correct.

This book is programming-first: in the next chapter you will set up a programming environment on your personal computer. Then, starting from chapter 3, you will be already solving programming exercises. Only later in the book, we circle back to formal definitions and the history of Computer Science. ◻


<< Preface   |   1. Introduction   |   2. Setting up what you need >>

index | submit | rank | book

Copyright © 2020-2023 Rudy Matela
All rights reserved