Computer Programming Work Overview
Computer Programming Work Overview
Bianca Gonçalves
Cristiane Assis
Deisiane Rodrigues
Nikolas Gonçalves
Nikokas Seixas
BELO HORIZONTE
2015
MINAS GERAIS SCHOOL OF ENGINEERING - FEAMIG
Belo Horizonte
2015
2
SUMMARY
1. Introduction...................................................................................................4
2. Resolution of the Exercises....................................................5
2.1 Exercises
3. Conclusion...................................................................................................14
15
3
1. Introduction
4
2. Resolution of Exercises
(1, 2, 3, 4, 5, 11, 12, 13, 14, 15, 26, 27, 28, 29,30)
2.1 What is a Compiler, what is it for? Give an example.
Provide an example.
2.4 Define, in your own words, what a logarithm is. Without doing
algorithm, can you program yourself?
Film.
Algorithm - Change a light bulb (After refinement)
Start
Take a ladder;
Go up the stairs;
Remove the burnt-out bulb;
Put in the new bulb;
Get down from the stairs;
1. Program name;
4. Creation of procedures;
6. Main code;
7
2.13. Fill in the appropriate Data Type and complete with a
observation. See Example.
8
2.14. Create the appropriate variables for the values below:
2.14.1. 12345 -Integer
2.14.2. 123.45 -Real
2.14.3. 1.23456 - Real
2.14.4 1549122 - Integer
2.14.5. X10 - Name
2.14.6. . TRUTH. -Logical
2.14.7. . V. -Logical
2.14.8. 812345605 - Integer
Name Yes
Variable T or F Justification
Base Salary F The use of hyphen "–" is not allowed. See slide 9.
August V Starts with the letter e and is not a reserved word. See slide 9
1 dollar
day V It must start with a letter, it cannot start with a number. See slide 9
result 2 F It must start with a letter, it cannot start with an underscore. See slide 9
_2 result F It must start with a letter, it cannot start with an underscore. See slide 9.
auxiliary F It must start with a letter, it cannot start with an underscore. See slide 9.
9
2.26. Create an algorithm that calculates the factorial of n (n!). Explain it.
reasons that led him to choose the structure used.
Algorithm 'Factorial'
Var
n
Start
Type a number
Read n;
For i from 1 to n do
Start
factorial := factorial * i;
Logical expressions are operations between logical values, the result of which is
logical. The expressions are:
No - It is used when there is a need to invert the logical result of a
a certain condition. Example: If 2 plus two equals 4, true, otherwise false.
Or - It is used when at least one of the relationships in the condition is required.
to be true. Example: If condition 1 is true or condition 2 is true,
your result will be true.
E - It is used when two or more expressions in the condition need to be
true. Example: If condition 1, condition 2, and condition 3 are
true, your result will be true, otherwise it will be false.
Logical expressions are used in the decision-making of the program.
10
2.28. Create an algorithm that calculates and writes the value of the sum
where?
Table of no
Condition 1 Result
True True
False False
Table of or:
11
True False True
Table of the e:
Program EX30
Var
int
Literal
Start
Write "Enter a letter"
While letter <> Z do
Read lyrics;
If letter = A then cont1 := cont1 + 1 or
If letter = E then cont2 := cont2 + 1 or
If letter = I then cont3 := cont3 + 1 or
If letter = O then cont4 := cont4 + 1 or
If letter = U then cont5 := cont5 + 1 else
12
Cont:= cont +1;
Film;
Write 'A', cont1;
Write "And" cont2;
Write 'I', cont3;
Write "O", cont4;
Write 'U', count 5;
End.
13
3. Conclusion
In this work, it was possible to gain a little more knowledge about algorithms and
Programming and its applications in our daily lives. We realize the importance of
algorithm and we understand that it is fundamental in planning,
development of any program.
14
4. Bibliography
LAGES NEWTON and GUIMARÃES ÂNGELO. Algorithms and Data Structures. Rio
Rio de Janeiro: Scientists Ed. LTDA, 1992, single volume.
15