KEMBAR78
IT112 Introduction | PDF | Computer Programming | Algorithms
0% found this document useful (0 votes)
18 views41 pages

IT112 Introduction

The document provides an introduction to computer programming using C#, explaining key concepts such as programming, algorithms, and flowcharts. It outlines the steps in the programming process, including problem definition, algorithm design, coding, and testing. Additionally, it discusses the history and features of C#, highlighting its object-oriented nature and recent updates.

Uploaded by

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

IT112 Introduction

The document provides an introduction to computer programming using C#, explaining key concepts such as programming, algorithms, and flowcharts. It outlines the steps in the programming process, including problem definition, algorithm design, coding, and testing. Additionally, it discusses the history and features of C#, highlighting its object-oriented nature and recent updates.

Uploaded by

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

IT 112

Computer Programming 1
Course Facilitator: Vicky A. Sinco
Unit 1- INTRODUCTION TO PROGRAMMING USING C#
What is Computer Programming
Computer programming is a way of giving
computers instructions about what they should do
next. These instructions are known as code, and
computer programmers write code to solve problems
or perform a task.
What is a Program?
Computer Program is a collection of instructions
that performs a specific task when executed by a
computer designed by a computer programmer.
Programming needs a language called Programming
Language to communicate with computers.
Steps in the Programming Process

1. Problem Definition
You need to understand the problem before you can
expect to get a correct solution to the problem.

I-RISE: TechUp
2. Algorithm Design
Break the problem into the steps of what must be done
to solve the problem. List what tasks need to be done to solve
the problem.

Example:

Write a program that adds two (2) numbers input by the user.
The program must display the sum and determine whether it is
odd or even.
3. Desktop Testing
In this step, you pretend to be a computer and execute
the steps in the algorithm. Follow the algorithm exactly, If you
don't get the right answer to the problem, then you have an
error in the algorithm.
4. Coding
Once the algorithm, or complete outline works correctly,
you need to translate the algorithm into a computer language
that your computer understands.

5. Testing and debugging


Enter the program into the computer, enter some test data, and
have the computer execute the program.
5. Documentation (optional)
Write a users’ manual for the users of your program to
know how to use it properly and step by step.
What is a Program Logic Formulation?

Logical reasoning – the use of logical thinking in order to


find results or draw conclusions

Algorithm- is a logical sequence of steps for solving a


problem that can be translated into a computer program.
Two ways of implementing an algorithm:
(Pseudo Code and Flowchart)

1. Pseudocode is an artificial and informal language that


helps programmers develop algorithms. It is usually a
combination of English words and some keywords of a
programming language.
Pseudo Code for Adding 2 input numbers:

Step 1: Start
Step 2: Declare variable sum.
Step 3: Read values for num1, num2.
Step 4: Calculate sum=num1+num2
Step 5: Display sum
Step 6: Stop
2. Flowchart is a
diagram that represents
the sequence of
operations in a process.
It is a graphic
representation of an
algorithm
In making a flowchart, the declaration of
variables is also given attention. These variables
will represent certain values. A variable is a
storage location capable of containing a certain
type of data that can be modified during
program execution.
What is the difference between Algorithm to
Flowchart?

Algorithms consist of a set of steps for solving a


particular problem, while in flowcharts, those steps
are usually displayed in shapes and process boxes
with arrows. So flowcharts can be used for presenting
algorithms.
3 Types of Flowchart Structures

1. Sequential Control
Structure (Sequential Flow)

-execution of flowchart is
continues
3 Types of Flowchart Structures

2. Selection Control
Structure
-the program has options
3 Types of Flowchart Structures

3. Repetition Control
Structure
-given sequence is repeated.
Rules of Drawing Flowcharts for Algorithms

• All boxes of flowcharts are connected with arrows to


show the logical connection between them,

• Flowcharts will flow from top to bottom,

• All flowcharts start with a Start Box and end with a


Terminal Box.
Examples of Flowchart for Algorithms
Example 1: Calculate the Interest
of a Bank Deposit

Algorithm:
• Step 1: Read amount,
• Step 2: Read years,
• Step 3: Read rate,
• Step 4: Calculate the interest with
formula
"Interest=Amount*Years*Rate/100
• Step 5: Print interest,
Examples of Flowchart for Algorithms

Example 2: Determine and Output


Whether Number N is Even or Odd

Algorithm:
• Step 1: Read number N,
• Step 2: Set remainder as N modulo
2,
• Step 3: If remainder is equal to 0
then number N is even, else
number N is odd,
• Step 4: Print output.
TRY THIS!!!

Determine Whether a Temperature is Below or Above


the Freezing Point

Algorithm:
Step 1: Input temperature,
Step 2: If it is less than 32, then print "below freezing
point", otherwise print "above freezing point"
TRY THIS!!!

Determine Whether A Student Passed the Exam or


Not:

• Algorithm:
• Step 1: Input grades of 4 courses M1, M2, M3 and M4,
• Step 2: Calculate the average grade with formula
"Grade=(M1+M2+M3+M4)/4"
• Step 3: If the average grade is less than 60, print
"FAIL", else print "PASS".
THE HISTORY OF C#

C# is pronounced as "C-Sharp". It is an object-oriented


programming language provided by Microsoft that runs on .Net
Framework.

Anders Hejlsberg is known as the founder


of C# language.
and more…

and more…

and more…
and more…

and more…

and more…
As of November 2023, the most recent stable
version of the language is C# 12.0, which was
released in 2023 in .NET 8.0.
C# Features
ASSIGNMENT

HISTORY OF C++

You might also like