0% found this document useful (0 votes)
15 views

Fundamentals of Programming

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Fundamentals of Programming

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

LESSON 1 INTRODUCTION TO FOP Assembler – is used to translate the

program written in Assembly


Program – Is a set of instructions that
language into machine code
you write to tell a computer what to
do. Interpreter – the translation of single
statement of source program into
Programmer – Is a person who writes
machine code is done by language
computer programs.
processor and executes it
Programming – is the action or immediately before moving on to
process of writing computer the next line
programs.
The C# programming language
Machine Level Language - consists
• C# was developed as an object-
of set of instructions that are in the
oriented and component-oriented
binary form 0 or 1
language
- Never written and rarely read • It exists as part of the Visual Studio
directly by programmers .NET package
• C# (like Java) is modeled after the
Assembly Language – contains
C++ programming language
mnemonic commands such as mov,
• Pointers are not used in C#
add, sub, etc.
• C# does NOT require the use of
- The assembler ( a program) object destructors, forward
translates assembly code into declarations, or #include files
machine code • It has the ability to pass by
reference
High Level Language - consists of
• Multiple inheritance is not allowed
English-like statements that are easy
in C#
to understand

- Translated into machine • The WriteLine() method prints a line


language by a compiler of output on the screen
- One to many: one HLL • Out is an object that represents the
statement translates into screen
several or dozen of machine • The Out object was created and
instructions endowed with the method
Compiler – The language processor WriteLine()
that reads the complete source • Not all objects have the WriteLine()
program written in high level method
language as a whole in one go.
• Console is a class - The problem on the 19th and
• Console defines the attributes of a early 20th century was solved
collection of similar “Console” by Turing Machine; An
objects abstract model of a
computer.
• System is a namespace, which is a
scheme that provides a way to CHARACTERISTICS OF AN ALGORITHM
group ( IODET)
similar classes
1. I - INPUT
• Namespaces are used to organize
2. O - OUTPUT
classes
3. D - DEFINITENESS
LESSON 2 – FLOWCHART AND 4. E - EFFECTIVENESS
PSEUDOCODE 5. T – TERMINATION

History PSEUDOCODE

- 9th century Persian Mathematician - A program design technique


Abu Abdullah Muhammad bin Musa that uses English words.
al-Kwarizmi - Has no formal syntactical rules
- Pseudo means false, thus
- Algorism – referred only to the rules
pseudocode means false
of performing arithmetic using
code.
Arabic Numeral
- They cannot be compiled nor
- 18th century – executed, and there are no
real formatting or syntax rules.
- Algorithm – all definite procedures
- Enables programmer to
for solving problems or performing
concentrate on the algorithms
task
without worrying about all the
Lady Ada Lovelace syntactic details of a particular
- 1842 First set of instructions programming language.
written for a computer.
- World’s first programmer
- Charle Babbage never
completed the engine and
was not implemented

Alan Turing
2. Effective Analysis: Flowchart
can help analyze the problem
in more effective way.
3. Proper Documentation: It
serves as a good program
documentation, which is
needed for various purposes.
4. Efficient Coding: It act as a
guide or blueprint during the
systems analysis and program
development phase.
FLOWCHART
5. Proper Debugging: The
flowchart helps in debugging
process.
6. Efficient Program
Maintenance: Maintenance of
operating program becomes
easy. It helps the programmer
to put efforts more efficiently
on that part.

Limitations of Using flowcharts ( CAR )

1. Complex logic: Flowchart


becomes complex and
clumsy.
2. Alterations and Modifications:
If alterations are required,
flowchart may require re-
drawing.
3. Reproduction: Flowcharts
ADVANTAGES OF USING cannot be typed, making it a
FLOWCHARTS ( CEPEPE) problem.

1. COMMUNICATION: Flowcharts Examples of flowcharts


are better way of
communicating the logic of a
system to all concerned.
2. An identifier should not start with a
number.

3. An identifier should not have any


white space.

4. An identifier should not be a C#


reserved word or keyword.

5. Identifiers are case sensitive in C#.

• const - is a C# keyword. It tells C#


that you are using a constant.
• const_name - is any valid identifier
given to the constant.
• value - is the initial value assigned
to the constant

• C# is a “Strongly Typed” language.


• All operations on variables are
LESSON 3: VARIABLES, DATA TYPES, performed with consideration of
AND OPERATORS what the variable’s “Type” is.
• There are rules that define what
Variables – are simply storage locations operations are legal to maintain
for data. the integrity of the data you put in a
- It is also an IDENTIFIER variable.
- You can place data into them Int – 32-bit signed integer
and retrieve their contents as
Float – 32-bit single-precision floating
part of a C# expression.
point type

Double – 64-bit double precision


floating point type

char – 16-bit single Unicode


character

1. Identifier is composed of bool – 8-bit logical true/false value


alphanumeric characters (A-Z, a-z, 0-
string – A sequence of Unicode
9,
characters
and _).
C# Operators priority and based on these
• Operators in C# are special priorities, the expression is evaluated.
symbols that perform some action on • The higher the precedence of
operands. operator is, the higher it appears in
• Most of these operators are similar the table
to the operators that you use
in Mathematics.

Arithmetic Operators

(+) – Addition

(-) – Subtraction

(*) – Multiplication

(/) – Division

(%) – Modulo Division

Relational/Comparison Operators MODULE 4: Conditional Statement

(=) – Assignment Operator C# conditional statements - are used


when we want to execute a certain
(>) – Greater than action depending upon an
(<) – Less than available condition.

(<>) – not equal if-Statement – made up of a Boolean


expression followed by a statement.
(>=) – greater than or equal to
- Executed only if the Boolean
(<=) – less than or equal to expression returns true.
Logical Operators - Single output only.

(&&) – AND If-else – an if statement with an


optional else that comes into picture
(||) – OR if the Boolean condition returns a
(!) – NOT false value.

Operator Precedence - Used for two possible outputs.


• Operator precedence is a set of Nested if – using if or else if statement
rules which defines how an inside another if or else if.
expression is evaluated.
• Each C# operator has an assigned - Multiple outputs.
Switch statement – a multiple branch While Loop - repeatedly execute a
decision statement. block of code as long as the
specified condition returns false.
- A variable is successively
tested against a list of integer
or character constants.
- Default part is executed if
theres no match.

Ternary Operator - starts with a


boolean condition. If this condition Do-While Loop - is the same as while
evaluates to true then it will execute loop except that it executes the
the first statement after ?, otherwise code block at least once.
the second statement after : will be
executed.

MODULE 5: LOOPING

Repetition Structure

- Permits a sequence of
instructions to be executed Nested Loops – are those loops that
repeatedly until a certain are present inside another loop.
condition is reached.
- Three forms: while, do-while, MODULE 6: STRING MANIPULATION
and for loop String – a sequence of characters
For loop - considered as a stored in a certain address in
predefined loop because the memory. Characters enclosed in
number of times it iterates to perform double quotation marks.
its body is predetermined in the STRING VARIABLE
loop’s definition. It contains a
counter whose values determine the - The value of string depends on
number of times the loop iterates. the user input.
- The value changes throughout
the program.
ToCharArray() – convert string to
array of characters.

Substring() – returns substring of a


string.

StartsWith() – checks whether the first


character of a string is same as
specifies character. Returns bool
value.
String Literal – also called a string Split() – splits the string on the
constant. Value does not changed. supplied value. Return the array of
- Value is fixed string.

EndsWith() – Determines whether the


end of this string instance matches a
specified string.

IndexOf() - Reports the zero-based


index of the first occurrence of a
specified Unicode character or string
within this instance.

LastIndexOf() – “LAST”

Replace() - Returns a new string in


Clone() – Returns a reference to this which all occurrences of a specified
instance of String. Unicode character or String in the
ToUpper() – converts string to upper current string are replaced with
case. another specified Unicode
character or String.
ToLower() – converts string to lower
case.

Trim() – removes extra spaces from


the beginning and the ending of
string.

Contains() – return bool value, it


checks whether specified string or
character exist in string or not.
OUTPUT.

You might also like