You are on page 1of 5

Centre for Diploma Studies Page No.

1/5
DAC 11102 : Edition 1
COMPUTER PROGRAMMING Revision No. 1
Title : Lab 2a - Effective Date SEPT. 2016
An Introduction to C Revision Date SEPT. 2020

CENTRE FOR
DIPLOMA STUDIES

PRINCIPLES OF PROGRAMMING

LAB INSTRUCTION SHEETS

COURSE CODE DAC 11102

TITLE AN INTRODUCTION TO C

PROGRAM DAA

LAB NO. 2a
Centre for Diploma Studies Page No. 2/5
DAC 11102 : Edition 1
COMPUTER PROGRAMMING Revision No. 1
Title : Lab 2a - Effective Date SEPT. 2016
An Introduction to C Revision Date SEPT. 2020

AIM: To Introduce Students to C Programming Language

1.0 OBJECTIVES

1. To introduce the interface of C programming software (DEV C++)


2. To develop C algorithm by using Microsoft Visual C++ Programming Language

2.0 Introduction

C is one of the most widely used programming languages of all time, and C compilers
are available for the majority of available computer architectures and operating
systems. Many later languages have borrowed directly or indirectly from C including
D, Go, Rust, Java, JavaScript, Limbo, LPC, C#, Objective-C, Perl, PHP, Python, and
Verilog

There are a few of free, open-source, cross-platform C/C++ software available online
such as Dev C++, Bloodshed C++, Microsoft Visual C++ and Code::Blocks.

By using any search engine online like Google or yahoo, search one of the software
above and download it and install it in your own computer.

The figures that will be used in this lab sheet will be from the Dev C++ 5.4.2 software.
Centre for Diploma Studies Page No. 3/5
DAC 11102 : Edition 1
COMPUTER PROGRAMMING Revision No. 1
Title : Lab 2a - Effective Date SEPT. 2016
An Introduction to C Revision Date SEPT. 2020
Dev C++ Software

1. Double click on your Dev C++ Icon and you will be prompted with the
below screen.

2. Choose File – New – Source File and you will be prompted with a screen where
you can type you C or C++ source code.
3. Type the below code.
Centre for Diploma Studies Page No. 4/5
DAC 11102 : Edition 1
COMPUTER PROGRAMMING Revision No. 1
Title : Lab 2a - Effective Date SEPT. 2016
An Introduction to C Revision Date SEPT. 2020
4. To execute or run your code you will need to go to Execute – Compile & Run or
press the keyboard button F11.
5. You will be asked to save your code like the figure below. Save your code in a
directory that you will remember. Example C:\DAE10202\ and click the Save
button

6. If there is no error in your code. You will get an output as per below screen.

7. That will be your first C program.


8. Perform your own trial and error on the code to get yourself more familiar with the
software.
Centre for Diploma Studies Page No. 5/5
DAC 11102 : Edition 1
COMPUTER PROGRAMMING Revision No. 1
Title : Lab 2a - Effective Date SEPT. 2016
An Introduction to C Revision Date SEPT. 2020

3.0 QUESTION

1. Identify and fix the error in the following code:

include <studio.h>

main
{

// Display Welcome to C to the console


printf(“welcome to C Programming);
}}

2. Write a C++ program that displays the following pattern:

@} \
@@}}------------
@} /

This is a Rose

You might also like