Upload
piyas-chowdhury
View
213
Download
0
Embed Size (px)
DESCRIPTION
Introduction to C program
Citation preview
Computer Basics & Programming Sessional Dept. of ETE, CUET
Prepared by Dr. Md. Azad Hossain & Piyas Chowdhury Supervised by Dr. Quazi Delwar Hossain
CHITTAGONG UNIVERSITY OF ENGINEERING AND TECHNOLOGY
DEPARTMENT OF ELECTRONICS AND TELECOMMUNICATION ENGINEERING
CHITTAGONG-4349, BANGLADESH.
COURSE NO.: CSE 182
Experiment No. 1
INTRODUCTIONTION TO C LANGUAGE
PRELAB WORK:
Read this laboratory manual carefully before coming to the
laboratory class, so that you know what is required.
Try to follow the lecture notes of CSE 181.
DONT copy others blindly!!!
Submit your lab report before the roll call.
OBJECTIVE:
a) To get familiar with C Language. b) To write down C program to print messages on output screen.
FOR OBJECTIVE-(a)
Run TC.exe from C:\TC\BIN
Click on File
Click on New
Click on File
Click on Save as
In the Save file as dialogue box give a name according to following format: ex1_rollno
For example if your roll no is 001 then give file name as:
ex1_001
Click on OK
Write down the code exactly (while you write frequently save the file by clicking File, then clicking Save. OTHERWISE YOUR WRITING WILL BE LOST IN CASE OF
POWER FAILURE)
Computer Basics & Programming Sessional Dept. of ETE, CUET
Prepared by Dr. Md. Azad Hossain & Piyas Chowdhury Supervised by Dr. Quazi Delwar Hossain
Program Code 1
/* Writing a Message */
#include
main( )
{
printf(Hello World);
}
After finishing the code click on Compile menu, then click on Compile.
If any is shown correct it.
Repeat above two step until Compile shows Success.
Then click on Run menu, then click on Run.
FOR OBJECTIVE-(b)
For Program Code 1, the output screen will be shown for few microseconds and will also be shown a warning. To avoid this problems the following Program Code should be
followed:
Program Code 2
/* Writing a Message */
#include
#include
void main( )
{
printf(Hello World);
getch( );
}
After execution Program Code 2, the output will remain in output screen. Therefore, when we again execute the program, the output of previous execution will also be shown.
To avoid this problem, we have to follow the following program code.
Program Code 3
/* Writing a Message */
#include
#include
void main( )
{
clrscr( );
printf(Hello World);
Computer Basics & Programming Sessional Dept. of ETE, CUET
Prepared by Dr. Md. Azad Hossain & Piyas Chowdhury Supervised by Dr. Quazi Delwar Hossain
getch( );
}
To write down messages in different lines we have to follow the following program code.
Program Code 4
/* Writing a Message */
#include
#include
void main( )
{
clrscr( );
printf(This is first statement.\n);
printf(This is second statement.);
getch( );
}
HOME TASK:
1. Write a C program to show your name, ID no., department and university on output screen as following format:
Name:
ID no.:
Department:
University: