Professional Documents
Culture Documents
Practice Module 2
Practice Module 2
Practice Module 2
Introduction to Programming
NIM/Name : ……………………………..
The objective of this module is student have capability to :
1. Describe how a program code could be a runable program on a computer device
2. Recognize the programming work environment
3. Identify parts of a program code and their uses
4. Translating the algorithm notation into C language code
5. Compile and run simple program code
6. Find program code errors and improve them
Open the DevC ++ program, then create a new file by clicking File> New> Source File, or clicking the
shortcut. In the file editor, type the simple code as shown in figure 1.
Create a new folder in your own data drive and give a name according to your NIM. Save the file in
your new folder by clicking File> Save and choose the folder you just created. Give the file name
1
Daspro Practice | Micky
1_myfirstprogram.c. and in the option "save as type" select the C source files (* .c) as shown in the
figure 2.
Through Windows Explorer, try to check the folder that you have created. State the name of the file
in the folder.
Compile the program by clicking Execute> Compile, or shortcut. Notice what happened next, is there
any error occur?
Show the result of your program (use the snipping tool to capture image) and describe it.
2
Daspro Practice | Micky
Reopen the folder that you created earlier. Notice what files are there now, any changed? Give your
conclusion?
Area_of_Rectangle Program
{Calculate the area of a rectangle by entering the length and width}
Declaration
length, width, area: integer
Algorithm
input (length)
input (width)
area length * width
output (area)
3
Daspro Practice | Micky
Save the code with file name 2_area_of_rectangle.c, then compile and run. Show the result of the
program (use the snipping tool to capture image) and describe it.
start
input
side
output
area
end
4
Daspro Practice | Micky
In the similar way, the flowchart can be translated into C language as following code.
Save the code with file name 3_area_of_square.c, then compile and run. Show the result of the
program (use the snipping tool to capture image) and describe it.
5
Daspro Practice | Micky
Show the result of the program (use the snipping tool to capture image) and describe it.
Conclusion
What do you learn from this practicum? Describe the conclusions that you obtained!
Submission:
Save the report with name P02_NIM.docx and your program files in folder named P02_NIM, upload your
work in zip file to http://learning-if.polibatam.ac.id.