Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
9 views16 pages

First Part CSC 201 Fug Introduction To Programming

Programming document

Uploaded by

ameermustapha20
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views16 pages

First Part CSC 201 Fug Introduction To Programming

Programming document

Uploaded by

ameermustapha20
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 16

DEPARTMENT OF COMPUTER SCIENCE

FEDERAL UNIVERSITY GUSAU


CSC 201 COMPUTER PROGRAMMING I

INTRODUCTION
You may already have used software, perhaps for word processing or spreadsheets, to solve
problems. Perhaps now you are curious to learn how programmers write software.
A program is a set of step-by-step instructions that directs the computer to do the tasks you
want it to do and produce the results you want. A set of rules that provides a way of telling a
computer what operations to perform is called a programming language. There is not,
however, just one programming language; there are many. In this course and its pre -
requisite you will learn about controlling a computer through the process of programming.
You may even develop interest as a computer scientist and discover that you might want to
become a programmer. An important point before we proceed: You will not be a programmer
when you finish reading this course or even when you finish reading the second course.
Programming proficiency takes practice and training beyond the scope of this course.
However, you will become acquainted with how programmers develop solutions to a variety
of problems.
In general, the programmer's job is to convert problem solutions into instructions for the
computer. That is, the programmer prepares the instructions of a computer program and runs
those instructions on the computer, tests the program to see if it is working properly, and
makes corrections to the program. The programmer also writes a report on the program.
These activities are all done for the purpose of helping a user fill a need, such as paying
employees, billing customers, or admitting students to college. The programming activities
just described could be done, perhaps, as solo activities, but a programmer typically interacts
with a variety of people. For example, if a program is part of a system of several programs,
the programmer coordinates with other programmers to make sure that the programs fit
together well. If you were a programmer, you might also have coordination meetings with
users, managers, systems analysts, and with peers who evaluate your work-just as you
evaluate theirs.

The Programming Process


Developing a program involves steps similar to any problem-solving task. There are five
main ingredients in the programming process:
1. Defining the problem
2. Planning the solution
3. Coding the program
4. Testing the program
5. Documenting the program

CSC 201 Computer Programming I Lecture Note FEDERAL UNIVERSITY GUSAU Page 1
Defining the Problem
Suppose that, as a programmer, you are contacted because your services are needed. You
meet with users from the client organization to analyze the problem, or you meet with a
systems analyst who outlines the project. Specifically, the task of defining the problem
consists of identifying what it is you know (input-given data), and what it is you want to
obtain (output-the result). Eventually, you produce a written agreement that, among other
things, specifies the kind of input, processing, and output required.
Planning the solution
There are two (2) common ways of planning the solution to a problem which are drawing a
flowchart and writing pseudocode, or possibly both. A flowchart is a pictorial
representation of a step-by-step solution to a problem. It consists of arrows representing the
direction the program takes and boxes and other symbols representing actions. It is a map of
what your program is going to do and how it is going to do it. The American National
Standards Institute (ANSI) has developed a standard set of flowchart symbols. The Figure
below shows the symbols and how they might be used in a simple flowchart of a common
everyday problem that involves preparing a letter for mailing.

Figure 1: Sample Flowchart


CSC 201 Computer Programming I Lecture Note FEDERAL UNIVERSITY GUSAU Page 2
A Pseudocode is an English-like nonstandard language that lets you state your solution with
more precision than you can in plain English but with less precision than is required when
using a formal programming language. Pseudocode permits you to focus on the program
logic without having to be concerned just yet about the precise syntax of a particular
programming language. However, pseudocode is not executable on the computer. We will
illustrate these later in this course, when we focus on language examples.

Coding the Program


As a programmer, your next step is to code the program-that is, to express your solution in a
programming language. You will translate the logic from the flowchart or pseudocode-or
some other tool-to a programming language. As we have already noted, a programming
language is a set of rules that provides a way of instructing the computer what operations to
perform. There are many programming languages: BASIC, COBOL, Pascal, FORTRAN, C,
C++ and C are some examples. You may find yourself working with one or more of these but
in this course, we will be focusing on C Programming Language.
Although programming languages operate grammatically, somewhat like the English
language, they are much more precise. To get your program to work, you have to follow
exactly the rules-the syntax-of the language you are using. Of course, using the language
correctly is no guarantee that your program will work, any more than speaking grammatically
correct English means you know what you are talking about. The point is that correct use of
the language is the required first step. Then your coded program must be keyed, probably
using a terminal or personal computer, in a form the computer can understand. Programmers
usually use a text editor, which is somewhat like a word processing program, to create a file
that contains the program. However, as a beginner, you will probably want to write your
program code on paper first.

Testing the Program


Some experts insist that a well-designed program can be written correctly the first time. In
fact, they assert that there are mathematical ways to prove that a program is correct.
However, the imperfections of the world are still with us, so most programmers get used to
the idea that their newly written programs probably have a few errors. This is a bit
discouraging at first, since programmers tend to be precise, careful, detail-oriented people
who take pride in their work. Still, there are many opportunities to introduce mistakes into
programs, and you, just as those who have gone before you, will probably find several of
them. Eventually, after coding the program, you must prepare to test it on the computer. This
step involves these phases:
 Desk-checking. This phase, similar to proofreading, is sometimes avoided by the
programmer who is looking for a shortcut and is eager to run the program on the
computer once it is written. However, with careful desk-checking you may discover
several errors and possibly save yourself time in the long run. In desk-checking you
CSC 201 Computer Programming I Lecture Note FEDERAL UNIVERSITY GUSAU Page 3
simply sit down and mentally trace, or check, the logic of the program to attempt to
ensure that it is error-free and workable. Many organizations take this phase a step
further with a walkthrough, a process in which a group of programmers-your peers-
review your program and offer suggestions in a collegial way.
 Translating. A translator is a program that (1) checks the syntax of your program to
make sure the programming language was used correctly, giving you all the syntax-
error messages, called diagnostics, and (2) then translates your program into a form the
computer can understand. A by-product of the process is that the translator tells you if
you have improperly used the programming language in some way. These types of
mistakes are called syntax errors. The translator produces descriptive error messages.
For instance, if in C you mistakenly write a statement without semi-column, you will
get a message that says, "Semi-column”;” expected" (Different translators may provide
different wording for error messages.) Programs are most commonly translated by
a compiler. A compiler translates your entire program at one time. The translation
involves your original program, called a source code, which is transformed by a
compiler into an object code. Prewritten programs from a system library may be added
during the link/load phase, which results in a load module. The load module can then
be executed by the computer.
 Debugging. A term used extensively in programming, debugging means detecting,
locating, and correcting bugs (mistakes), usually by running the program. These bugs
are logic errors, such as telling a computer to repeat an operation but not telling it how
to stop repeating. In this phase, you run the program using test data that you devise.
You must plan the test data carefully to make sure you test every part of the program.

Documenting the Program


Documenting is an ongoing, necessary process, although, as many programmers are, you
may be eager to pursue more exciting computer-centered activities. Documentation is a
written detailed description of the programming cycle and specific facts about the program.
Typical program documentation materials include the origin and nature of the problem, a
brief narrative description of the program, logic tools such as flowcharts and pseudocode,
data-record descriptions, program listings, and testing results. Comments in the program
itself are also considered an essential part of documentation. Many programmers document
as they code. In a broader sense, program documentation can be part of the documentation
for an entire system. The wise programmer continues to document the program throughout
its design, development, and testing. Documentation is needed to supplement human memory
and to help organize program planning. Also, documentation is critical to communicate with
others who have an interest in the program, especially other programmers who may be part of
a programming team. And, since turnover is high in the computer industry, written
documentation is needed so that those who come after you can make any necessary
modifications in the program or track down any errors that you missed.

Example 1: Temperature conversion


CSC 201 Computer Programming I Lecture Note FEDERAL UNIVERSITY GUSAU Page 4
Celsius (or centigrade) to Fahrenheit
Problem Statement: Write an algorithm of a program that converts temperature from
Celsius (or centigrade) to Fahrenheit. The program also output the equivalent temperature.
Problem Analysis: Given a temperature in one degree, the algorithm should convert it to
another degree by using the formula : F=(C * 5/9) +32.
Input: A temperature in Celsius (or centigrade).
Output: Equivalent temperature in Fahrenheit

The algorithm
1. Read the temperature given in degree Celsius.

2. Convert the temperature in Celsius to Fahrenheit using the formula: F=(C * 5/9) +32

3. Print the Fahrenheit value of the temperature.

4. End

Example 2: Fahrenheit to Celsius


Problem Statement: Write an algorithm of a program that converts temperature from
Fahrenheit to Celsius (or centigrade) to Fahrenheit. The program also output the equivalent
temperature.
Problem Analysis: Given a temperature in Fahrenheit degree, the algorithm should convert
it to Celsius degree by using the formula: C=5/9*(F-32).
Input: A temperature in Fahrenheit (or centigrade).
Output: Equivalent temperature in Celsius
The algorithm
1. Read the temperature given in degree Fahrenheit.
2. Convert the temperature in Fahrenheit into Celsius using the formula: C=5/9*(F-32)
3. Print the Celsius value of the temperature.
4. End

Try the following questions:


a. Calculating area of rectangle
Write an algorithm of a program that calculates area of a given the length and breadthof the
rectangle. The program output the area.

b. Calculating area of circle


Write an algorithm of a program that calculates area of a circle given the radius. The program
output the area

CSC 201 Computer Programming I Lecture Note FEDERAL UNIVERSITY GUSAU Page 5
Example 3. Let’s consider a problem of writing a simple program that can solve quadratic
equation using general formulae i.e.

Defining the problem phase


We will start by breaking the problem into simpler sub problems. Solving quadratic equation
using general formulae can be broken into two by first calculating determinant (D) as
, then use it to determine the values of where if D = 0, then
have the same value which is , also if D > 0, then and
, and if D < 0 then have no solution because square root of
negative number result to a complex number.
We then identify input data, output and computations involves as follows:
Input data: Values of .
Output: Values of
Computations: , and
Planning the solution
We plan the solution first by drawing the flowchart as follows:

Start

Input a, b & c

Compute

D<0 D>0
If D =
0

Compute X = Compute
Print “No solution”

Print “x1 and x2 have the same


Compute
Stop solution" X

StopFEDERAL Print x1 & x2


CSC 201 Computer Programming I Lecture Note UNIVERSITY GUSAU Page 6

Stop
Figure 2: Flowchart solution of example 1.

Then we write the pseudocode (Algorithm) as follows:


Step 1: Input a, b & c
Step 2: Compute D (Determinant)
Step 3: if D is 0 then,
Compute X =
Print “X1 & X2 have the same solution” X
Else if D > 0 then,
Compute and .
Print x1 and x2
Else
Print “There is no solution”.

Example 4: Consider a problem of designing a program that receives C.A and Exam scores
of the students and determines whether students pass or fail base on their total score. The
total score is calculated as the sum of C.A and Exam scores.

Solution: We design the program by drawing a flowchart and write a pseudo code of the
problem solution as follows:

Flowchart:
START

Input
C.A & Exam

Total = C.A + Exam

FALSE TRUE
If Total <
40
GRADE<5
0

Print “PASS” Print “FAIL”

CSC 201 Computer Programming I Lecture Note FEDERAL UNIVERSITY GUSAU Page 7
STOP
Figure 2: Flowchart solution of example 2.

Pseudocode:
Step 1: Input C.A & Exam
Step 2: Calculate the Total by summing C.A and Exam
Step 3: if Total is below 40
Print “FAIL”
else
Print “PASS”

Exercises
1. Write a pseudo code and draw a flowchart that will receives C.A and Exam scores of
the student and determines the grade of the student.
2. Write an algorithm and draw a flowchart that will read the two sides of a rectangle and
calculate its area
PROGRAMMING LANGUAGES
A Computer can only do what a program can make it to do. To perform a particular, task the
programmer writes a sequence of instructions, called program. Computer is designed to
understand a specified set of instruction code and each of these instructions are stored in the
main memory in the form of binary numbers. Therefore, the symbols of a particular computer
language must be converted to binary set of instructions by the compiler/interpreter.
Computer languages can be classified into three broad categories:
a. Machine language
b. Assembly language
c. High level
Machine Language
The set of instruction codes, whether in binary or in decimal notation, which can be directly
understood by the computer without the help of a translator, is called a machine code or
machine language program. A computer understands information composed only zeros and
ones and hence it uses binary digits for its operation. The computer’s instructions are
therefore coded and stored in memory in the form of 0’s and 1’s. A program written this form
is called machine language program. For example, a typical program instruction to print out a
number on the printer might be:
1011000111110100100

Assembly Language

CSC 201 Computer Programming I Lecture Note FEDERAL UNIVERSITY GUSAU Page 8
Programs can be easily written in alphanumeric symbols instead of 0’s and 1’s. Meaningful
and easily remembered symbols are selected for this purpose. For example, ADD for
addition, SUB for subtraction, CMP for comparison, etc. Such symbols are known as
mnemonics. A program written in mnemonics is called assembly language program. The
writing of programs in assembly language is easier and faster as compared to the writing of
programs in a machine language.
High Level Language
To overcome the difficulties associated with assembly language, high-level language or
procedure-oriented was developed. High-level languages permit programmers to describe
tasks in a form which is problem oriented rather than computer oriented. A programmer can
formulate problems more efficiently in a high-level language.
The instructions written in a high-level language are called statements. The statements more
closely resemble English and mathematics as compared to mnemonics in assembly
languages. Examples of high-level languages are; BASIC, PASCAL, FORTRAN, COBOL,
ALGOL, PL/1, PROLOG, LISP, ADA, C, C++, C#, C, etc.

Coding the Program


As a programmer, this is where the job is which involves converting the solution designed
into instructions that computer understand using programming language as a tool. As
mentioned earlier, in this course we will focus on writing programs using C programming
language.
Historical Overview of C
The programming language C is a general-purpose computer language. It was originally
created by Denis M. Ritche for the specific purpose of writing Operating System software.
The developments in C have seen many evolutionary processes. Like any other programming
language, the original version of C language has undergone a number of revisions. The C
language was derived from a language known as BCPL. C language provides the facilities to
do programming at registers level.

IDENTIFIER
To be able to refer to entities stored in computer memory, C allows the programmer to attach
names to portions of memory. The technical name for these names is Identifiers. In C, an
identifier can be any combination of letters and numbers but must conform to the following
three rules:
1. It begins with a letter or an underscore (_).
2. It does not contain any space or special symbols like &, (, `
3. It is not a C reserved (key) word

Examples of valid identifiers include radius, myJob and a.


Examples of invalid identifiers include 3years, two numbers and main

C DATA TYPES
CSC 201 Computer Programming I Lecture Note FEDERAL UNIVERSITY GUSAU Page 9
Data types represent how identifiers are stored in the computer or in lay terms, the amount of
space reserved for an identifier in memory. C data types are divided into two broad groups:
- Numeric
o Integer (byte, short, int, long)
o Floating point (float, double)

- Non Numeric
character
Boolean

Constant and Variable


A constant value: A constant is a value we have written into the program. A constant can be
an Integer, Floating-Point, Boolean, Character or String constant, e.g. “Hello world!” is a
literal string value and 10 is a constant integer value. Constants are considered to be hard-
coded values as they cannot be changed while the program is running.

Variable: The variable is the basic unit of storage in a C program, it is a memory location
that is use to store value which can be referred to in a program. A variable is defined by the
combination of an identifier/variable name, a type, and an optional initializer. In addition, all
variables have a scope, which defines their visibility, and a life time. An identifier is
normally referred to as a variable when it is used to hold data items to be used in a program.
A variable can be declared to hold a data value of any of the data types.

Variable Declaration
In C, all variables must be declared before they can be used. A declaration provides the
compiler with information about how many bytes in the memory should be allocated for that
variable and how this variable should be interpreted. The basic form of a variable declaration
is shown below:

<datatype>< identifier/variable name>;

A variable can be declared and initialize at the same time by specifying an equal sign and a
value as follows:

<data type>< identifier/variable name> = value;

Note: Keep in mind that the initialization expression must result in a value of the same (or
compatible) type as that specified for the variable.

CSC 201 Computer Programming I Lecture Note FEDERAL UNIVERSITY GUSAU Page 10
We can also declare more than one variable of the same type in the same statement with each
variable name separated by commas as follows:

<data type>< identifie1, identifier2,……………., identifier>;

Here are several examples of variable declarations of various types. Note that some include
an initialization.
int a, b, c; // declares three ints, a, b, and c.
int d = 3, e, f = 5; // declares three more ints, initializing d and f.
byte z = 22; // initializes z.
double pi = 3.14159; // declares an approximation of pi.
char x = 'x'; // the variable x has the value 'x'.

Variable Types

The C programming language defines the following kinds of variables:

 Local Variables Similar to how an object stores its state in fields, a method will often
store its temporary state in local variables. The syntax for declaring a local variable is
similar to declaring a field (for example, int count = 0;). There is no special keyword
designating a variable as local; that determination comes entirely from the location in
which the variable is declared — which is between the opening and closing braces of a
function. As such, local variables are only visible to the functions in which they are
declared; they are not accessible from the rest of the program.
 Parameters A parameter is a variable use to pass values to a function which is used in
its computations

CONSTANTS
A constant is an entity whose value does not change in the course of program execution.
Constants are also referred to as literals. Constant can be numeric values or strings. If the
analysis specifies a value is to be stored in memory and will not change while the program is
running then the variable should be declared as a constant, by using the final keyword as
follows:

<data type><identifier/constant name> = constant value;

For example, double PI = 3.143;


Note: Capital letters are used in given constant name/identifier.

The following are constants recognized in C:


i) Integer Constant
CSC 201 Computer Programming I Lecture Note FEDERAL UNIVERSITY GUSAU Page 11
This must be from the set of numbers from 0 through 9.
Integer constant can be decimal integer (Base 10) e.g 599, 287, 348 etc
It can be octal integer (Base 8) e.g 0777, 03671 etc.
It can be Hexadecimal integer (Base 16). This is represented by a leading ox or
OX. The range is from 0 -15, A – F e.g 0X89, 0X91, 0XEF
ii) Floating Point Constant
This represents numbers with decimal values that represent fractions. Floating
point constant can represent in two ways:
- Standard decimal notation e. g 1.07 0.654 2.053f
- Scientific notation or exponent form e.g 5.5602E12, 341E0-4
iii) Character Constant
A character constant is represented inside a pair of single quotes. It is used to
represent the ASCII characters and special symbols. Examples are:

\’ Single quote
\” Double quote
\\ Backslash
\b Back space
\t tab
\n New line
\r Carriage return on a printer.
iv) Boolean Constant
Boolean constant has two values true and false. Also, the value of true or false
does not convert to any numeric value. E.g flag = true; flag2 = true;
v) String Constant
This is a sequence of characters enclosed between double quotes e.g “Mike”
“Course Participants”, “7688”, “1919”
String surname = “Mudassir”;
String matricNo = “200801102222”

OPERATIONS
All processing within a C program is executed as a mathematical calculation. Thus, the term
“calculations” is broader than simply its mathematics reference.

With C there are three types of calculations:


• Arithmetic
• Logical
• String

ARITHMETIC OPERATORS

CSC 201 Computer Programming I Lecture Note FEDERAL UNIVERSITY GUSAU Page 12
These are the operators used for performing arithmetic operations in a C program. A simple
arithmetic expression has the form:

OP1 operator OP2

OP1 and OP2 are called the operands which are going to be operated on. The following table
lists the various operators and their functions:

Operator Function
+ Adds OP1 and OP2
- Subtracts OP2 from OP1
* Multiplies OP1 by OP2
/ Divides OP1 by OP2 and discards the remainder
% Gives the remainder when OP1 is divided by OP2

The divide operator can carry out either real or integer division depending on the
values used in the equation. For example, 5/2 will yield the result 2 (and not 2.5). This is
because both values are integer, which forces divide operator to carry out an integer division.
If you wish to carry out a real division then cast one of the value, for example (double)5/2
which will yield 2.5 (and not 2). Applying the double cast temporary converts the first integer
value into a double, thus ruling out integer division.

Casting Primitives
Quite often in programming we assign the value contained in one variable to another variable
for example the following code assigns the value stored into num1 (i.e. 10) to the variable
num2, such that both variables now store 10 as their value.
• int num1=10, num2;

num2 = num1;

Such an assignment was possible because the variables were of the same type. It is not
allowed to directly assign between variables of different types.

For example, the following assignment is not allowed, even though the int type can hold the
value 10.

long longNumber=10;
int intNumber;
intNumber = longNumber;

CSC 201 Computer Programming I Lecture Note FEDERAL UNIVERSITY GUSAU Page 13
To assign between variables of different numeric types we must use casting and to
assign between numeric and string types we must use appropriate conversion methods.

A cast is basically a type command which precedes the source variable and has a temporary
effect of converting the value in the source variable to that specified by the cast
• Format: destinationVariable = (cast) sourceVariable;
• Example: intNumber = (int) longNumber;

In the above example the cast (int) was applied to the long type source variable, so its
contents are temporarily converted to the type integer in order to execute the assignment.
Note if the value being casted is greater than that can be stored in the destination variable
then an Overflow exception will occur. An exception is a runtime error message.

Arithmetic Calculations
In C arithmetical calculations are deemed to be an expression, i.e. equate to a value, and as
such form only part of a statement. In coding an arithmetical calculation, we need to decide
how to use the result of the calculation, for which we have two options
• Store the result for later use, e.g. result = 5 + 2
• Output the result immediately, e.g. printf(5 + 2);

It is recommended to always store the results of calculation into variables.

ARITHMETIC CALCULATIONS AND VARIABLES


The key benefit of a computer program is dynamic processing, i.e. applying a calculation
with different values. For our programs this means using the input variables (and any key
values) within the calculation.

Operator Example num1 num2 resultD


+ result = num1 + num2 5 2 7
- result = num1 - num2 5 2 3
* result = num1 * num2 5 2 10
/ result = num1 / num2 5 2 2
/ resultD = (double)num1 / num2 5 2 2.5
% result = num1 mod num2 5 2 1

Some examples:
1. 1 / 2 = 0
2. 86/10 = 8
3. 86%10 = 6
4. 2 * 3.2 = 6.4
Arithmetic expressions are evaluated according to the following priority rules:

CSC 201 Computer Programming I Lecture Note FEDERAL UNIVERSITY GUSAU Page 14
1. Highest priority: ( ) Bracketed expressions
2. Second priority: *, /, %
3. Lowest priority: +, -
In addition, all expressions are evaluated from left to right. In the presence of parenthesis,
evaluation starts from the innermost parenthesis
Example: 3 + 7%2 = 3 + 1 = 4
(2 – 5)*5/2 = -3*5/2 = -15/2 = -7

ASSIGNMENT STATEMENT
An assignment statement is a statement that is used to manipulate the value of a variable or to
calculate it using values of other variables. The syntax of an assignment statement is as given
below:
Variable = expression;
The expression on the right is evaluated and the result is assigned to the variable on the left.
The left side must be a variable as illustrated below:
a = 5;
b = a;
b = b + 25;
a + b = 15; // invalid because left side is not a variable

Example: If variable x = 20, and y = 16, how do you interchange the contents of the two
variables?
Ans: A third variable must be introduced as follows:
z = x; // store the contents of x in the third variable
x = y; // copy the value of variable y into x
y = z; // copy the value of variable x into y

SHORT HAND ASSIGNMENT OPERATORS


C provides a number of shorthand assignment operators:

Short form Equivalent


OP1 += OP2 OP1 = OP1 + OP2
OP1 -= OP2 OP1 = OP1 – OP2
OP1 *= OP2 OP1 = OP1 * OP2
OP1 /= OP2 OP1 = OP1 / OP2
OP1 %= OP2 OP1 = OP1 % OP2

Example: a += 5; //equivalent to a = a + 5;
INCREMENT AND DECREMENT OPERATORS

CSC 201 Computer Programming I Lecture Note FEDERAL UNIVERSITY GUSAU Page 15
Increment/decrement operations are very common in programming. It is very common to
come across a situation where you need to increase or decrease a variable by 1 as shown in
the example below
a = a + 1;
counter = counter – 1;

C provides operators that make these operations shorter.

Operator Use Description


++ OP++ Increments OP by 1
-- OP-- Decreases OP by 1

Example: int y = 20;


y++; // the new value of y is 21
EQUALITY AND RELATIONAL OPERATORS
The table below summarizes the equality and relational operators used in C:
Operator Sample C condition Meaning
== X == Y X is equal to Y
!= X != Y X is not equal to Y
> X>Y X is greater than Y
< X<Y X is less than Y
>= X >= Y X is greater than or equal to Y
<= X <= Y X is less than or equal to Y

CSC 201 Computer Programming I Lecture Note FEDERAL UNIVERSITY GUSAU Page 16

You might also like