You are on page 1of 31

Course Specification

Basic Information
Course Title Computer Programming I Sessional
Course Code CSE-1106
Pre-requisite
Credit 2
Academic Session Autumn 2018
Offered to 1st Semester
Level Basic
Category Major
Program BSc. in Electrical and Electronic Engineering
Department Electrical and Electronic Engineering
Professional Information
a. Rationale: This structured programming course provides a comprehensive introduction to
the ANSI C language, emphasizing portability and structured design. Students are introduced
to all major language elements including fundamental data types, flow control and standard
function libraries. Thorough treatment is given to the topics of control statements, loops,
array, functions, string and character manipulation, dynamic memory allocation, standard
I/O, macro definition, and the C runtime library. The course explains the use of structures,
unions, and pointers early on so the students can practice extensively in the hands on labs.
Computer Graphics, bitwise operations, Enumerations, Header files, Preprocessors, Macros
etc. are also covered. Emphasis is given to the processing of command line arguments and
environment variables so students will be able to write flexible, user-friendly programs.
Comprehensive hands on exercises are integrated throughout to reinforce learning and
develop real competency.
b. The objectives of this course are :
1. Overall 1. To introduce the basic structure of a program and importance of program in real life.
aims of 2. Identifying the steps involved in creating a program and itemizes the elements of a
course typical program.
3. Understanding the essential concepts of Programming Techniques.
4. Understanding the nature and function of a mid-level language (C) constructs and
syntax.
5. The concept of control constructs.
6. The concept of looping techniques.
7. Key concepts of array, structure, pointer and file handling.
8. Describe how functions are constructed and implemented.
9. Give a brief account of library function, user-defined functions, preprocessor, bit
field and graphics.
10. To enhance problem solving skills.

Students learning time (Total 128 hours)


a) Face to face 32 hours (lectures including class tests)
b) Independent 83 hours (Library, internet, assignments, home study etc.)

Page 1 of 31
Knowledge and Understanding:
On successful completion of the course, graduates should be able to:
1. Define the concept of a program and a few specific examples of programs
2. Identify the essential of the concepts of Programming Techniques.
3. Describe fundamental topics in computing including software architectures, software
engineering principles and methodologies and software tools.
4. Outline basic knowledge and understanding of a core of analysis.
5. Explain the nature and function of a mid-level language’s constructs and syntax(C)
6. Identify the tools, practices and methodologies used in the specification, design,
implementation and evaluation of computer programs.

Intellectual Skills:
On successful completion of this course, graduates should be able to:
1. Break a large problem into smaller parts, writing each part as a module or function.
2. Generate an innovative design to solve a problem containing a range of commercial
and industrial constraints.
3. Analyze the requirements of a range of computer-based systems and examine the
design alternatives based on the constraints imposed by society, organizations, and
technology.
4. Work with and model computer systems at different and appropriate levels of
abstraction.
5. Enhance ability to approach problems systematically.

2. Intended Professional and Practical Skills


Learning On successful completion of this course, graduates should be able to:
Outcomes 1. Use appropriate programming languages and tools, and design methodologies.
(ILO) 2. Interpret verbal problem specifications into program code
of the 3. Design, write and debug computer programs in C language.
course.
General and Transferable Skills
On successful completion of this course, graduates should be able to:
1. Communicate effectively by oral, written and visual means.
2. Develop interpersonal skills planning and managing personal time and work.
3. Work effectively as an individual and as a member of a team.
4. Manage tasks and resources.
5. Manage one's own learning and development, including time management and
organizational skills.

Attitude:
1. A knowledge and respect of ethics and ethical standards in relation to a major area of
study.
2. Demonstrate an ethical behavior toward software copyrights.
Transferable Skills:
1. Present effective computer programs that employ efficient algorithms.
2. Present a design of algorithms for solving scientific problems related to other
disciplines.
3. Present a project or a product.
4. Work in stressful environment and within constraints.
5. Manage tasks and resources.
6. Apply improved problem solving skills to basic real world situations.
7. Search for information and adopt life-long self-learning.
At the end of the program students are able to:

Page 2 of 31
1. Will gain skills as apply knowledge effectively in
diverse contexts. Knowledge

2. Will gain skills as apply knowledge with creativity and


initiative to new situations. In doing so,
will: Demonstrate mastery of a body of knowledge that
includes recent developments in computer science and
Knowledge
information technology; Recognize and use research
principles and methods applicable to computer science
and information technology.

3. Will learn to accurately and objectively examine and


consider computer science and information technology
(IT) topics, evidence, or situations, in particular to:
(i) Analyze and model requirements and constraints for
the purpose of designing and implementing software Critical Analysis
artifacts and IT systems; (ii) Evaluate and compare
designs of software artifacts and IT systems on the
basis of organizational and user requirements.

4. Capability to analyze problems and synthesize suitable


solutions will be extended as learn to: Design and
implement software solutions that accommodate
Problem Solving
specified requirements and constraints, based on
analysis or modeling or requirements specification.

5. Will learn to communicate effectively with a variety of


audiences through a range of modes and media, in
particular to: Present a clear, coherent and independent
exposition of software applications, alternative IT
solutions, and decision recommendations to both IT
and non-IT personnel via technical reports of
professional standard and technical presentations. Communication
Interpret abstract theoretical propositions, choose
methodologies, justify conclusions and defend
professional decisions to both IT and non-IT personnel
via technical reports of professional standard and
technical presentations.

6. Will learn to work as an effective and productive team


member in a range of professional and social situations,
in particular to: Work effectively in different roles, to
form, manage, and successfully produce outcomes from Team Work
teams whose members may have diverse cultural
backgrounds and life circumstances and differing levels
of technical expertise.
This course provides a comprehensive introduction to the modern study of Computer
Synopsis
Course

3.

Programming. It presents many programming features and covers them in considerable


depth, yet makes their design and analysis accessible to all levels of students. We have
tried to keep explanations elementary without sacrificing depth of coverage or
mathematical rigor.
1. Content outline of the course / module and the SLT per topic

Page 3 of 31
Learning Task/Reading
Weeks Topics
Hours (author/page)
1 Introduction to CPU 2

2 Introduction to C Programming 2
a)Write a program that will print your mailing address
in the following form
3 Introduction to Turbo C. 2
a) Modify the above program to provide border lines to
the address.
b) Given the radius of a circle, write a program to
compute and display its area. Use a symbolic constant to
define the π value and assume a suitable value for
radius.
4 Familiar with for Loop 2

5 Familiar with switch Statement and for Lop 2

6 Familiar with array and 2nd array Statement 2

Mid-Term Examination: 30 marks, Time: 1.5 hours; Answer any three questions out of four.
Each question will carry 10 marks. There may be two/ three parts in each question.
7 Introduction to Pointer 2

8 Familiar with Function 2

9 Familiar with Structure 2

10  Write a program using one print statement to print the 2


pattern of asterisks as Shown below:

 *
 * *
 * * *
 * * * *

11 Given the values of three variables a, b and c, write a 2
program to compute and display the values of x, where
X= a / (b - c) Execute your program for the following
values:
(a) a=250, b==85,c=25
(b) a=300, b=70, c=70
Comment on the output in each case

Page 4 of 31
12 Relationship between Celsius and Fahrenheit is 2 Class test
governed by the formula
F = (9C/5) +32 Write a program to convert the
temperature
(a) From Celsius to Fahrenheit and
(b) From Fahrenheit to Celsius.
13 Revision Class 2

Final Examination: 50 marks; Time: 2.5 hours; Answer any two questions out of three from group A
and any three questions out of four from Group B. Each question will carry 10 marks. There may be
two/ three parts in each question.
5( a).
Teaching- Type of Assessment Description
Learning / Assignments/Term Paper Independent study, group discussion
assessment Lectures In-class discussion
strategy
5(b) Mode of Lecture, Class Discussion, Reading & Writing Assignment, and Class Test
Delivery
6. Assessment LO Method %
Methods and Assignment +Quiz / Class Test 10
Type/Course
Assessment Class Attendance 10
State Mid Semester Examination ( After six weeks) 30
weightage of Final Examination ( After 15 weeks) 50
each type of
assessment. TOTAL 100
7. Mapping of course / module to the Programme Learning Outcomes
Learning Outcome of the course
01 02 03 04 05 06
Basic programming in C, essential concepts, programming
√ √
1. style, variables and data types, long, float, double, Boolean,
character, strings;
Logical expressions and control constructs: if-else, nested if, √ √
2.
switch, arithmetic and assignment statements;
Define, compare, analyze, and solve general programming
3. √ √
problem types: sorting, searching and geometric;
Implement, empirically compare, and apply fundamental
4. √ √
programs to real-world problems.
Have some understanding of an advanced topic, which
varies from year to year. Recent choices have included:
5. √
Computer Graphics, Linear Programming, Computational
Geometry, and String Matching.
8. Textbook:
i. Byron S. Gottfried: Schaum’s Outline of Theory and Problems of Programming with C,
3/e, McGraw-Hill, 2011.
9. Reference Books:
i. Herbert Schildt: Teach Yourself C, 3/e, Osborne McGraw-Hill, 1997.
ii. Robert Lafore: The Waite Group's C programming Using Turbo C++, 2/e, Techmedia,
2002.
iii. E. Balagurusamy: Programming in ANSI C, 2/e, Tata McGraw-Hill Publishing Company
Limited, 1992.

Page 5 of 31
iv. C Kernighan & D.M. Ritchie: The C Programming Language, 2/e, Prantice-Hall of India,
1994.
v. Herbert Schildt: Turbo C / C++: The Complete Reference, 2/e, Osborne McGraw-Hill,
1992.
vi. H. M. Deitel, P. J. Deitel: C How to Program, 3/e, Pearson Education Asia, 2001.
vii. Steve Summit: C Programming FAQs, Pearson Education, Inc, 2001.

10. Facilities Required for Teaching and Learning


 A lecture hall is equipped with a projector and a computer.
 Labs are equipped with computers and Internet facilities.
 A library.

Prepared by: Checked by: Approved by:

_______________________ _______________________ _______________________


Md. Eftekhar Alam, Muhammad Athar Uddin Dr. Md. Monirul Islam
Lecturer, Department of Associate Professor & Head, Dean, Faculty of Science and
Electrical and Electronic Department of Electrical and Engineering, IIUC
Engineering, IIUC Electronic Engineering, IIUC

Page 6 of 31
Experiment List
Experiment No.01
Introduction to CPU

Experiment No.02
Introduction to C Programming
a) Write a program that will print your mailing address in the following form

Experiment No.03
Introduction to Turbo C
a) Modify the above program to provide border lines to the address.
b) Given the radius of a circle, write a program to compute and display its area. Use a
symbolic constant to define the π value and assume a suitable value for radius.

Experiment No. 04
Name of the Experiment: Familiar with for Loop

Experiment No. 05
Name of the Experiment: Familiar with switch Statement and for Lop

Experiment No. 06
Name of the Experiment: Familiar with array and 2nd array Statement

Experiment No. 07
Name of the Experiment: Introduction to Pointer

Experiment No. 08
Name of the Experiment: Familiar with Function

Experiment No. 09
Name of the Experiment: Familiar with Structure

Page 7 of 31
Experiment No. 10
Name of the Experiment: Write a program using one print statement to print the pattern of
asterisks as Shown below:

*
* *
* * *
* * * *

Experiment No. 11
Name of the Experiment: Given the values of three variables a, b and c, write a program to
compute and display the values of x, where X= a / (b - c) Execute your program for the following
values:
(a) a=250, b==85,c=25
(b) a=300, b=70, c=70

Comment on the output in each case.

Experiment No. 12
Name of the Experiment: Relationship between Celsius and Fahrenheit is governed by the
formula F = (9C/5) +32 Write a program to convert the temperature

(a) From Celsius to Fahrenheit and


(b) From Fahrenheit to Celsius.

Page 8 of 31
International Islamic University Chittagong
Department of EEE
Course No. CSE – 1106

01. Introduction to CPU

A central processing unit is the electronic circuitry within a computer that carries
out the instructions of a computer program by performing the basic arithmetic,
logical, control and input/output operations specified by the instructions.

02. Introduction to C Programming

Definition of Programming C:

C was originally developed by Dennis Ritchie between 1969 and 1973 at Bell Labs,
and used to re-implement the UNIX operating system. It has since become one of
the most widely used programming languages of all time, With C compilers from
various vendors available for the majority of existing computer architectures and
operating systems.

Page 9 of 31
Write a program that will print your mailing address in the following form:

Algorithm: -

Algorithm to print your mailing address.

Step 1: Display your Name and Go to new line.


Step 2: Display your Door No and Street and Go to new line.
Step 3: Display your City and Pin Code.

Flowchart:-

Program: -

//Write a program that will print your mailing


//address in the following form:
//First line: Name
//Second line: Door No, Strret

Page 10 of 31
//Third line: City, Pin Code
//Date: 11/03/2010

#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf("Name :-- Ritesh Kumar Jain\n");
printf("Door No :-- 57 , Street :-- Parkho Ki Gali\n");
printf("City :-- Nimbahera , Pin Code :-- 312601");
getch();
}

Output:--
Name: -- Ritesh Kumar Jain
Door No: -- 57, Street: - Parkho Ki Gali
City: -- Nimbahera, Pin Code: -- 312601

Page 11 of 31
03. Introduction to Turbo C.

a) Modify the above program to provide border lines to the address.

b) Given the radius of a circle, write a program to compute and display its
area. Use a symbolic constant to define the π value and assume a suitable
value for radius.

 Modify the above program to provide border lines to the address.

Algorithm: -

Algorithm to provide border lines to address.


Step 1: Display ------------------------------------------------- line and Go to new line.
Step 2: Display ------------------------------------------------- line and Go to new line.
Step 3: Display ||, your Name, || and Go to new line.
Step 4: Display ||, your Door No and Street, || and Go to new line.
Step 5: Display ||, your City, Pin Code, || and Go to new line.
Step 6: Display ------------------------------------------------- line and Go to new line.
Step 7: Display ------------------------------------------------- line.

Flowchart:-

Page 12 of 31
Display ||, your Name, || & go to new line
Display ||, your Door No and Street, || & go to new line
Display ||, your City and Pin Code, || and go to new line
A
Display ------------ & go to new line
Display ------------
END

Program:-
// Write a program that will print your mailing
//address in the following form:
//-----------------------------------------
//-----------------------------------------
//|| First line : Name ||

Page 13 of 31
//|| Second line : Door No, Strret||
//|| Third line : City, Pin Code ||
//-----------------------------------------
//-----------------------------------------
//Date: 11/03/2010
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();

Output:-

---------------------------------------------------
---------------------------------------------------
|| Name: -- Ritesh Kumar Jain ||
|| Door No: -- 57, Street: - Parkho Ki Gali ||
|| City: -- Nimbahera, Pin Code: -- 312601 ||
---------------------------------------------------
---------------------------------------------------

Page 14 of 31
 Given the radius of a circle, write a program to compute and display its area. Use a
symbolic constant to define the π value and assume a suitable value for radius.

Algorithm:--

Algorithm to compute the area of circle.

Step 1: Store 3.14 to varable PIE.


Step 2: Store 4 to variable Rad.
Step 3: Compute the area of circle and assign it to variable Area.
Area = PIE * Rad * Rad
Step 4: Display the variable.

Flowchart:--

Program:--

Page 15 of 31
//Given the radius of a circle, write a program to compute
//and display its area. Use a symbolic constant to define the
//PIE value and assume a suitable value for radius.

#include<stdio.h>
#include<conio.h>
#Define PIE 3.14
void main()
{
clrscr();
float Rad,Area;
Rad=4;
Area=PIE*Rad*Rad;
printf("Area of a circle is--> %f",Area);
getch();
}

Output:--

Area of a circle is 50.240002

Page 16 of 31
04. Familiar with for Loop
A for-loop is a control flow statement for specifying iteration, which allows code to be executed
repeatedly. The syntax of a for-loop is based on the heritage of the language and the prior
programming languages it borrowed from, so programming languages that are descendants of or
offshoots of a language that originally provided an iterator will often use the same keyword to
name an iterator.

Descendants of ALGOL use "for", while descendants of FORTRAN use "do." There are other
possibilities, for example COBOL which uses "PERFORM VARYING".

Page 17 of 31
05. Familiar with switch Statement and for Lop

{
Case contant -1:
statement – 1:
brack ;
case content -2;
statement -2;
brack;

……………………..
……………………..
……………………..
case contant - n;
statement - n;
break;
default;
default statement – x;
break;
}

 Code :

#include<stdio.h>
#include<conio.h>
void main()
{
Int scorce, grade;
clrscr();
printf (“\n\a Enter your score”);
scanf (“%d”, & score);
grand = score / ;
switch (grand)
{case 10:
case 9:
printf (“\n\a your grade is A”);
brack;
case 8:

Page 18 of 31
printf (“\n\a your grade is B”);
brack;
case 7:
printf (“\n\a your grade is C”);
brack;
case 6:
printf (“\n\a your grade is D”);
brack
default
printf (“\n\a your grade is F”);
brack;
}
}
getch();

Output:

Enter Your Score: 67


Your grade is: D

Page 19 of 31
06. Familiar with array and 2nd array Statement

Code :

#include <stdio.h>
#include <conio.h>
#define ROW 3
#define COL 5
int main ()
{int row, col;
float arryed [ROW][COL]={{1.0,2.0,3.0,4.0,5.0},{6.0,7.0,8.0,9.0,10.0}{11.012.013.014.015.0}};
clrscr();
for (row= 0;row<row; row;++)
{
for (col= 0;col<col; col;++)
{
Print (‘\n Element [7,6] [%d] [%d] = %6.2” row, col, array 2 d [row] [col];
}
}
getch ( )
return 0;
}

Output:

Element [0] [0] = 1.00


Element [0] [1] = 2.00
Element [0] [2] = 3.00
Element [0] [3] = 4.00
Element [0] [4] = 5.00
Element [1] [0] = 6.00
Element [1] [1] = 7.00
Element [1] [2] = 8.00
Element [1] [3] = 9.00
Element [1] [4] = 10.00
Element [2] [0] = 11.00
Element [2] [1] = 12.00
Element [2] [2] = 13.00
Element [2] [3] = 14.00
Element [2] [4] = 15.00

Page 20 of 31
07. Introduction to Pointer

Pointers of C programming: Pointers in C are easy and fun to learn. Some C programming tasks
are performed more easily with pointers, and other tasks, such as dynamic memory allocation,
cannot be performed without using pointers. So it becomes necessary to learn pointers to become
a perfect C programmer. Let's start learning them in simple and easy steps.

Code:

#include<stdio.h>
#include<conio.h>
Main ( )
{
int x,y;
int * ptr;
x = 10
p + r;
printf (“value of x is %d\n\n\n”,x);
printf (“%d is stored at addr% u\n,” x, &x);
printf (“%d is stored at addr% u\n,” * &x, &x);
printf (“%d is stored at addr% u\n,” * p+r, p+r);
printf (“%d is stored at addr% u\n,” y, & = y); * p+r = 25
printf (“\n now x = % d/n” x);
}

Output:
Value of X is 10
10 is stored at addr 4104
10 is stored at addr 4104
10 is stored at addr 4104
4104 is stored at addr 4106
10 is stored at addr 4108
Now X = 25

Page 21 of 31
08. Familiar with Function
Function of c programming: The Main Function. In C, the "main" function is treated the same as
every function, it has a return type (and in some cases accepts inputs via parameters). The only
difference is that the main function is "called" by the operating system when the user runs the
program.

Page 22 of 31
09. Familiar with Structure

Structured of C programming : Structured programming is a programming paradigm aimed at


improving the clarity, quality, and development time of a computer program by making extensive
use of subroutines, block structures, for and while loops - in contrast to using simple tests and
jumps such as the go to statement, which could lead to "spaghetti code" that is difficult to follow
and maintain.

Page 23 of 31
10. Write a program using one print statement to print the pattern of asterisks as Shown
below:

*
* *
* * *
* * * *

Algorithm: -

Algorithm to print the pattern of pattern of asterisks.

Step 1: Display * and go to new line


Step 2: Display * * and go to new line.
Step 3: Display * * * and go to new line.
Step 4: Display * * * *

Flowchart:-

Page 24 of 31
Program:-

//Write a program using one print statement to


//print the pattern of asterisks as shown below:
//*
//* *
//* * *
//* * * *
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf("* \n* * \n* * * \n* * * *");
getch();
}

Output: -

*
* *
* * *
* * * *

Page 25 of 31
11. Given the values of three variables a, b and c, write a program to compute and
display the values of x, where X= a / (b - c) Execute your program for the following
values:

(a) a = 250, b==85,c=25


(b) a = 300, b=70, c=70
Comment on the output in each case.

Algorithm:--

Algorithm to compute the value of x.

Step 1: Store 250, 85 and 25 to variables a, b and c respectively.


Step 2: Compute a / (b – c) and store the result in variable x.
Step 3: Display x
Step 4: Store 300, 70 and 70 to variables a, b and c respectively.
Step 5: Compute a / (b – c) and store the result in variable x.
Step 6: Display x

Flowchart:--

Page 26 of 31
Program:--

//Given the values of three variables a, b and c,


//write a program to compute and display the values of x, where
//X= a / (b - c)
//Execute your program for the following values:
//(a) a=250, b==85,c=25
//(b) a=300, b=70, c=70
//Comment on the output in each case.

#include<stdio.h>
#include<conio.h>
void main()

Page 27 of 31
{
clrscr();
int a,b,c;
float x;
a=250;
b=85;
c=25;
x=a/(b-c);
printf("x = %f\n",x);
a=300;
b=70;
c=70;
x=a/(b-c);
printf("x = %f\n",x);
getch();
}

Output:--
x=4.000000
Divide error

Page 28 of 31
12. Relationship between Celsius and Fahrenheit is governed by the formula
F = (9C/5) +32 Write a program to convert the temperature

(a) from Celsius to Fahrenheit and


(b) from Fahrenheit to Celsius.

Algorithm:--

Algorithm to convert from Celsius to Fahrenheit and from Fahrenheit to Celsius.

Step 1: Store 0 to F & C.


Step 2: Store 200 to C.
Step 3: Compute ((9*c)/5) +32 and store the result in F.
Step 4: Display F.
Step 5: Store 300 to F.
Step 6: Compute ((F-32)*5)/9 and store the result in C.
Step 7: Display C.

Flowchart:--

Page 29 of 31
START
F=0
C=0
C=200
F= (((9*C)/5)) +32
Display F
F=300
C= ((F-32)*5)/9
Display F

Program:--
//Relationship between Celsius and Fahrenheit is governed by the formula
//F = (9C/5)+32
//Write a program to convert the temperature

//(a) from Celsius to Fahrenheit and


//(b) from Fahrenheit to Celsius.

#include<stdio.h>
#include<conio.h>
void main()
{
float F,C;
clrscr();
C=200;
F=(((9*C)/5)+32);
printf("Celsius = %f to Fahrenheit = %f\n",C,F);
F=300;
C=((F-32)*5)/9;

Page 30 of 31
printf("Fahrenheit = %f to Celsius = %f\n",F,C);
getch();
}

Output:--
Celsius =200.000000 to Fahrenheit = 392.000000
Fahrenheit = 300.000000 to Celsius = 148.888885

Page 31 of 31

You might also like