LABORATORY MANUAL REPORT
IT-21014
PROGRAMMING LANGUAGE I
PROGRAMMING IN C
MAY, 2019
DEPARTMENT OF COMPUTER ENGINEERING
AND INFORMATION TECHNOLOGY
YANGON TECHNOLOGICAL UNIVERSITY
Course Description
This course introduces the basic concepts of C programming language. It leads the student to
understand the features of variable and constant declarations, arithmetic operations, input/output
operations, functions and recursion, arrays, pointers, and structures. It is focused on writing
programs that are more readable and maintainable. It helps the reuse of code by using a group of
similar objects or using the functions. It also helps thinking in a logical way by using the
concepts of pointer and arrays.
Course Goals and Objectives
By studying this course, the student can
- understand the fundaments of C programming
- apply the fundamental syntax rules for identifiers, declarations, expressions, statements
and functions
- analyze the problems using pointer, array, structure and decision loop control structure of
C programming
- construct the programs using the fundamental elements of C
Hardware and Software Requirements
Hardware Requirements: Desktop or Laptop Computers
Software Requirements: Dev-C++ software or C-Free5 software (Update Version)
Textbook
Let Us C, Yashavant P. Kanetkar, 5th Edition
Reference
The Complete Reference C, Herbert Schildt, 4th Edition
2017-2018 Academic Year (Semester I)
Lab No. Experiments
1. Software Installation
Getting Started to C Programming Language
C Instruction, Arithmetic Operators and Library Functions
2. Solve the Problems using Decision Control Structure
3. Solve the Problems using Loop Control Structure
4. Solve the Problems using Case Control Structure
5. Applying Functions and Pointers
6. Implementation Data Structure using Arrays
7. Implementation Data with Structure
8. Exam for Lab Test
Experiment 1
Software Installation
Objective
The students will be able to install software by themselves.
Procedure
Step 1: Open Computer
Step 2: Browse the source installer file
Step 3: Double click on Dev-C++ Version-4.9.9.2_.exe
Step 4: Step by step installation is as follows:
Select the language: English
Welcome wizard
Click Next to continue
Click “I accept the agreement” then Next
Select destination location, then Next
Click Install button
Installation process
Finally, Installation is complete and ready to use Dev-C++ software
Experiment 1
Getting Started to C Programming Language
Objective
The students will be able to
apply software
understand how can write the source code to start the program
Procedure
Click File, and then create New file
Example of C program
#include <stdio.h>
main()
{
printf(“Welcome to IT Department\n”);
}
Experiment 1
C Instruction, Arithmetic Operators and Library Functions
Objective
To know the fundamental concept of C programming language
To analyze the conversion of Data types, arithmetic operators and library functions
Task
Exercise1:
Ramesh’s basic salary is input through the keyboard. His dearness allowance is 40% of basic salary and
house rent allowance is 20% of basic salary. Write a program to calculate his gross salary.
Exercise2:
The distance between two cities in km is input through the keyboard. Write a program to convert and
print this distance in meters, feet, inches and centimeters.
Exercise3:
If the marks are obtained by a student in five different subjects are input through the keyboard. Find out
the aggregate marks and percentage marks obtained by the student. Assume that the maximum marks
that can be obtained by a student in each subject is 100.
Experiment 2
Solve the Problems using Decision Control Structure
Objective
To solve the problems using basic decision control structure (if statement, if-else statement, if-
else if-else statement)
To consider the critical thinking how to obtain the correct output in different ways
Task
Exercise1:
Write a program that tests an exam mark is pass, pass with distinction or fail.
Exercise2:
Write a program that will input two numbers and find the maximum number and minimum number.
Exercise3:
Write a program to find prime numbers between 1 and 50.
Experiment 3
Solve the Problems using Loop Control Structure
Objective
To solve the problems using basic loop control structure ((while loop, for loop, do-while loop, ,
break, continue)
To consider the critical thinking how to obtain the correct output in different ways
Task
Exercise1:
Write a program to sort the three integers a, b, and c in ascending order. The number will be given from
the keyboard.
Exercise2:
Write a program to input two numbers and then display the following menu:
- Sum of two numbers
- Subtract the second number from the first
- Multiply the two number by the second
- Divide the first number by the second
- None of the above
The program will then produce the output selected by the user from the menu.
Experiment 4
Solve the Problems using Case Control Structure
Objective
To solve the problems using case control structure (switch, break, continue)
To consider the critical thinking how to obtain the correct output in different ways
Task
Exercise1:
Write a menu driven program which has following options:
1. Factorial of a number
2. Prime or not
3. Odd or Even
4. Exit
Make sure of switch statement.
Experiment 5
Applying Functions and Pointers
Objective
To analyze C functions and pointers for the modularity of the program
- What is a function
- Why use function
- Passing Value between Functions
- Call by Value
- Call by Reference
To solve the more complex problems
- Insert Sorting
Task
Exercise1:
Write a menu driven function program to input two numbers and then display the following menu:
- Sum of two numbers
- Subtract the second number from the first
- Multiply the two number by the second
- Divide the first number by the second
- None of the above
The program will then produce the output selected by the user from the menu.
Exercise2:
Write a function to calculate the area of a room. Ask the user to enter the length and width of the room.
Experiment 5
Implementation Data Structure using Arrays
Objective
To implement data structure using arrays
- What are arrays
- Two Dimensional Arrays
- Array of Pointers
- Three Dimensional Arrays
Task
Exercise1:
Write a C program that calculates and prints average value of up to 20 test scores.
Exercise2:
Write a program that counts the number of odd and even from the int array.
Exercise3:
Write a C program that creates two arrays one for part number and one for price for each part. Moreover
that program finds the corresponding price for given part number.
Experiment 6
Implementation Data with Structures
Objective
To examine the structure
Task
Exercise1:
Create Date structure which contains day, month and year member data. Write a C program which accepts
member data from keyboard and display them.
Exercise2:
Create Book structure which contains title, author, ISBN number and price member data. Write a C
program that it accepts five books from keyboard and display them by using structure array.
Exercise3:
Create Library_book structure which contains a Book structure and a Date structure. Write a C program
for creating Library_book array for three books and display that array.