Professional Documents
Culture Documents
1 Lab PF
1 Lab PF
1 Lab PF
1.2 PURPOSE:
• In school, students use computers for tasks such as writing papers, searching for articles,
sending email, and participating in online classes.
• At work, people use computers to analyze data, make presentations, communicate with
customers and coworkers, control machines in manufacturing facilities, and do many other
things.
• At home, people use computers for tasks such as paying bills, shopping online,
communicating with friends and family, and playing computer games.
• The uses of computers are almost limitless in our everyday lives. Computers can do such
a wide variety of things because they can be programmed.
1.3 TOOL:
Code::Blocks is an open-source, cross-platform (Windows, Linux, MacOS), and free
C/C++ IDE. It supports many compilers, such as GNU GCC (MinGW and Cygwin) and MS
Visual C++. It supports interactive debugging (via GNU GDB or MS CDB). Code::Blocks is
surprisingly versatile. The mother site of Code::Blocks is ww.codeblocks.org.
1.4 INSTALLATION:
1.5 GETTING STARTED WITH C:
A program is a set of instructions that a computer follows to perform a task.
There is a close analogy between learning English and learning C language.
1.5.1 DATA TYPES:
o Integer type:
1.5.3 Output:
printf( ) is used for output and display.
Syntax:
Printf ( "<format string>", <list of variables> ) ;
1.5.4 Input:
scanf( ) is used for input.
Syntax:
scanf ( "<format string>", <&list of variables> ) ;
1.6 IN LAB TASKS:
Task 1:
Write a program to print your name and class.
(******Neelum Rasheed*******)
(****Electrical Engineering****)
Task 2:
Write a program that input two values and output the sum of these values.
Task 2: Write a program that calculate the area of Triangle and Rectangle by taking the values
length and width as an input, where formulas are given below.
area of triangle = length ∗ width
area of rectangle = 2(length + width)