Professional Documents
Culture Documents
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.
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.
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
3.
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
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
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.
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
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
Page 8 of 31
International Islamic University Chittagong
Department of EEE
Course No. CSE – 1106
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.
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: -
Flowchart:-
Program: -
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.
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.
Algorithm: -
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:--
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:--
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:
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:
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
Page 23 of 31
10. Write a program using one print statement to print the pattern of asterisks as Shown
below:
*
* *
* * *
* * * *
Algorithm: -
Flowchart:-
Page 24 of 31
Program:-
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:
Algorithm:--
Flowchart:--
Page 26 of 31
Program:--
#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
Algorithm:--
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
#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