Labreportsampleofcprogramming 240106103456 E3c12f1c
Labreportsampleofcprogramming 240106103456 E3c12f1c
for
PROGRAMMING IN C LAB
(BCA)
2nd Semester
Bachelor in Computer Application
LOGO
Prepared by
……………..
Lecturer
Department of Computer Science
TU
Page 1
OBJECTIVES
COURSE OUTCOME
After completing this lab course you will be able to:
Page 2
INTRODUCTION ABOUT LAB
Steps involved in program development: -
To develop the program in high level language and translate it into machine level
language following steps have to be practised.
1. Writing and editing the program.
2. Linking the program with the required library modules.
3. Compiling the program.
4. Executing the program.
Turbo C/C++
Open Turbo C/C++ from your Desktop or Programs menu. Select “File” from
Menu bar and select option “New” and Save C program with filename „.C‟
extension.
To do compiling – Select -> Compile from menu and click-> compile.
If the compilation is successful – you will see a “success” message. Else you
will see the number of errors.
To RUN the program – you may select ->Run from menu and click -> Run
Now you will see the output screen.
Page 3
Structure of “C Program” :
C program is a collection of several instructions where each instruction is written
as a separate statement. The C program starts with a main function followed by
the opening braces which indicates the start of the function. Then follows the
variable and constant declarations which are followed by the statements that
include input and output statements.
Page 4
INSTRUCTIONS TO STUDENTS FOR PREPARING
PROGRAMMING IN C LAB REPORT
This Lab Manual is prepared to help the students with their practical
understanding and development of programming skills, and may be used as a base
reference during the lab/practical classes.
Students have to submit Lab Exercise report of previous lab into corresponding
next lab, and can be collected back after the instructor/course coordinator after it
has been checked and signed. At the end of the semester, students should compile
all the Lab Exercise reports into a single report and submit during the end semester
sessional examination.
“Sample of Lab report” is shown for LAB Exercise #1 in this manual. For the rest
of the labs, the reporting style as provided is to be followed. The lab report to be
submitted during the end semester Sessional Examination should include at least
the following topics:-
1. Top Cover page – pg. 9 (to be used while compiling all the Lab Exercise
reports into single report)
2. Index – pg. 10 (to be used while compiling all the Lab Exercise reports into
single report)
3. Cover page – pg. 11 (to be attached with every Lab Exercise)
4. Title of the program
5. Algorithm (optional)
6. Flowchart (optional)
7. Coding
8. Output (compilation, debugging & testing)
Students are to show the coding and output to the instructor/course co-ordinator
for the additional lab exercises given in each lab module.
Note: The lab exercises may not be completed in a single specific lab. Students are
encouraged to complete the programming questions given in the exercise prior to
come to the lab hour and do the lab for the given programs.
Page 5
College Name
logo
SUBMITTED BY
Name:
Roll No.
Submission Date:
Submitted To:
Page 9
INDEX
1. Exercise – 1
(i) Program 1… ....................................................................... 1
(ii) Program 2 ........................................................................... 2
(iii) Program 3, etc.
2. Exercise – 2 ……………………………………………………. ..
3. Exercise – 3 ………………………
4. etc.
5. etc.
Page 10
College name
Logo
LAB Exercise 1
Lab Date:
Submission Date:
Page 11
LAB EXERCISE #1
Objective(s):
To be familiar with syntax and structure of C-
programming. To learn problem solving techniques
using C
Algorithm:
Step 1: Start
Step 2: Declare variables num1, num2 and sum.
Step 3: Read values for num1, num2.
Step 4: Add num1 and num2 and assign the result to a variable sum.
Step 5: Display sum
Step 6: Stop
Flowchart:
Page 12
Page 13
CODE….
#include <stdio.h>
#include <conio.h>
int main()
{
int num1, num2, sum;
printf("Enter first number: ");
scanf("%d", &num1);
printf("Enter second number: ");
scanf("%d", &num2);
Output:
Page 14