Figure 1. Basic I/O Activity 1 Flowchart

Download as pdf or txt
Download as pdf or txt
You are on page 1of 22

II.

Activity Section

Basic I/O Activity 1

a. Problem
Write a C program that will print the statement “Animo La
Salle!”
b. Algorithm
-Input: Enter “Animo La Salle!”
-Process:
-Output: “Display Animo La Salle!”
c. Flowchart

Figure 1. Basic I/O Activity 1 Flowchart


The figure above indicates the steps needed to do to create the
output “Animo La Salle!” The input for this program is “Animo La Salle!”
After inputting the statement, the program shows the statement. The
program simply puts the input to the output window. The program
comes to a stop after the output step.
d. Source Code

e. Program Output
Basic I/O Activity 2

a. Problem
Write a program that will determine the sum of two numbers.
b. Algorithm
Input: Enter two numbers (n1, n2)
Process: Compute for the sum (sum=n1+n2)
Output: Display the sum (sum)

c. Flowchart

Figure 2. Basic I/O Activity 2 Flowchart


The figure above shows the process of determining the sum of
two numbers in the program. The program starts with asking for two
numbers. The program then computes for the sum of the two values
using the formula sum=n1+n2. This value is then showed to the output
window. The program then comes to a stop afterwards.
d. Source Code

e. Program Output
Basic I/O Activity 3

a. Problem
Write a program that will calculate the area of a circle.
b. Algorithm
Input: Enter the radius of a circle (r)
Process: Compute for the area of a circle (A=pi*r*r)
Output: Display the area of the circle (A)
c. Flowchart

Figure 3. Basic I/O Activity 3 Flowchart

The figure above indicates the process of determining the area of a


circle. The only input in this program is the radius of the circle. The program
then processes the area of the circle given by the formula pi*r*r. After
processing this value, the program then shows this value in the output
window. Since this is the only scope of the code, the program is terminated
afterwards.
d. Source Code

e. Program Output
Basic I/O Activity 4

a. Problem
Write a C program that will compute for the average grade of
three quizzes.
b. Algorithm
Input: Enter the grades of the three quizzes (q1, q2, q3)
Process: Compute for the average of the three quizzes (Ave=
(q1+q2+q3/3)
Output: Display the average of the three quizzes
c. Flowchart

Figure 4. Basic I/O Activity 4 Flowchart


The program shows the steps which the program must follow.
The program starts with asking for the values of the three quizzes which
are stored in the variables q1, q2, and q3. The program then computes
for the average of the three quizzes. This value is calculated by the
obtaining the sum of the three quizzes and dividing the value by three.
The program then shows the average grade and stops the program.
d. Source Code

e. Program Output
Basic I/O Activity 5

a. Problem
Make a C program that will compute for the term grade given the
following:
a. 8 laboratory reports
b. 1 term project
c. 1 practical exam

b. Algorithm
Input: Enter the grades of 8 laboratory reports, term project, and
practical exam (a, b, c, d, e, f, g, h, t, p)
Process: Compute for the average of lab reports, ratings for each
subject, and final grade for the term (lra, tg, ra, pr, er)
Output: Display lab report rating, term project rating, practical exam
rating, and term grade (ra, pr, er, tg)
c. Flowchart

Figure 5. Basic I/O Activity 5 Flowchart


The figure above shows the steps the program must do. The
program starts with inputting of the grades of 8 lab reports, 1 term
project, and 1 practical exam. The program then computes for the
average of the 8 lab reports by getting the sum of the 8 lab report
grades and dividing this value by 8, the rating for the lab report by
multiplying the value by 0.3, the rating of the term project by
multiplying the value by 0.3, and the term grade by obtaining the
summation of the lab report times 0.4, practical exam times 0.3, and
term project times 0.3. The output of this program are the lab report
rating, term project rating, practical exam rating, and term project
grade. After this step, the program comes to a stop.
d. Source Code

e. Program Output
III. Supplementary Section
Basic I/O Supplementary 1
a. Supplementary Worded Problem
Write a C program that will calculate the gross salary of Ana given
that her house allowance is 30% of basic salary, and medical
allowance is 20% of basic salary.

b. Supplementary Program Algorithm


Input: Enter basic data (basic)
Process: Compute for housing, medical, and gross data (housing,
medical, gross)
Output: Display data (housing, medical, gross)
c. Supplementary Program Flowchart

Figure 6. Basic I/O Supplementary 1 Flowchart


The figure above indicates the steps used by the program to
execute the code. The input for this program is the basic income of Ana.
The process of the code involved the computation of the housing data
by multiplying the basic data value by 0.3, medical by multiplying the
basic data value by 0.2, and gross data by taking the difference of the
basic data value and the summation of the housing and medical value.
The program then shows these values to the output window. The
program stops afterwards.
d. Supplementary Source Code

e. Supplementary Program Output


Basic I/O Supplementary 2

a. Supplementary Worded Problem


Write a C program that will to write and show a resume.
b. Supplementary Program Algorithm
Input: Enter resume data (FN, LN, ED, CN, HA, PSN, PSA, PYA, SSN,
SSA, SYA,
TCD, TSN, TSA, TYA, SO, ST, STR, AO, AT, HO, HA0, RF, RL, FPR, CNR,
CAR, CPR, REA)
Process:
Output: Display resume data

c. Supplementary Program Flowchart

Figure 7. Basic I/O Supplementary 2 Flowchart


The figure above indicates the flowchart of steps to be followed
by the program in order to create a resume. The input of this
program are the resume data indicated by the variables FN, LN, ED,
CN, HA, PSN, PSA, PYA, SSN, SSA, SYA, TCD, TSN, TSA, TYA, SO, ST,
STR, AO, AT, HO, HA0, RF, RL, FPR, CNR, CAR, CPR, and REA. These
characters are asked from the user. The program then prints these
values to the output screen. The program is then terminated.

d. Supplementary Source Code


e. Supplementary Program Output
IV. Program Observation and Conclusion
The first activity mainly utilizes the printf statement. The goal of the program
is to show the property of printf by using this statement to put the inputted
statement, in this case, “Animo La Salle!” to the output screen. This program is
simply an introductory code for students who are starting to learn C programming.
The printf statement is the most basic activity that could be done. There are no
variables or asking of values from the user; it is simply the printing of the statement.
The second activity utilizes the printf and scanf statement since the program
asks the user for data for the two numbers. This program makes use of the
arithmetic operator, addition. The program is expected to compute for the
summation of the two numbers given by the formula n1+n2. This value is then
outputted to the output window through the use of the printf statement. The
program also only makes use of the int variable.

The third activity asks for the area of a circle. The user is asked for the radius
of a circle only. The program is expected to compute for the area. Multiplication is
also utilized in this program. The program also makes use of float for the value of
the area.

The fourth activity makes use of arithmetic operations mainly addition and
division. The program asks for the average of three quizzes, whereas the user is
expected to input three grades of the quizzes. The program also utilizes printf and
scanf statements. However, the program mainly shows the users the
implementation of arithmetic operation in C. Different variables are also used here,
where a float variable is used.

The fifth activity showcases arithmetic operations in C programming. The user


is expected to create a program that will compute for the final grades. The program
makes use of addition, subtraction, multiplication, and division. The program also
makes use of floats and integer variables. The program also uses the basic input and
output functions, printf and scanf.

The first supplementary activity makes use of printf and scanf statements and
basic arithmetic operations. To be specific the arithmetic operations used are
multiplication, addition, and subtraction. The program asks for only one value, the
basic income of the individual. From this value, the user is expected to write a code
that will compute for three other data, which are the housing, medical, and gross
data. These values are expected to appear in the output window, and so the
utilization of the printf statement is present in this step of the program.

The second supplementary activity uses the printf and scanf statements
extensively. The program simply asks for data from the user and prints this in the
output screen. The second supplementary activity involved the making of a basic
resume. There are no arithmetic operations or other concepts than input and output
involved. Variables are also explored in this activity as these are used extensively.

The whole experiment explores the basic input and output function of C
programming. The experiment also explores basic arithmetic operations such as
addition and subtraction. This experiment gives the student an introductory idea of
some of the most basic concepts (printf, scanf) in C programming. The student is
expected to master these concepts as these are simply basic concepts.

You might also like