You are on page 1of 4

Page 1 of 4

FACULTY OF MECHANICAL ENGINEERING


In the name of Allah, The Most Beneficent, The Most Merciful

La b 1

Program Structure, Printing and Comments


Prepared By: Rosmazi bin Rosli Fakulti Kejuruteraan Mekanikal Universiti Malaysia Pahang Lab Location:

Lab Objectives: By the end of this lab, students should be able to: Construct a simple C program involving printing and comments

Date: ____________________ Student Name Student ID Section

/20

// In the name of *ALLAH/GOD, we declare that this is our original work.

BMM 1312 Computer Programming Lab

Page 2 of 4

TASK 1. Construct a C program to display your name. Put your student ID as comment

---------------------------------------- Source code ------------------------------------------------

----------------------------------------

result ------------------------------------------------

BMM 1312 Computer Programming Lab

Page 3 of 4

/5
TASK 2. Construct 2 programs as below; Program 1 Printf(We love programming); Printf(It is soooooo easy); Program 2 Printf(We love programming\n); Printf(It is soooooo easy); State the difference between these 2 programs. Then replace \n in Program 2 of TASK 2 with below and state the result(s). (a) \a (b) \t (c) \0 (d) \b (e) \\ (f) \/ (g) \ (h) \ (i) \?
---------------------------------------answer ------------------------------------------------

BMM 1312 Computer Programming Lab

Page 4 of 4

TASK 3

/5

Write a program which will display the results below, noted that you need to make sure every law align to its statement: Newton 1st Law Inertia? ^_^ Newton 2nd Law F=ma Newton 3rd Law Force=Normal Newton 4th Law 4th law!? r u kidding me?

---------------------------------------- Source code ------------------------------------------------

BMM 1312 Computer Programming Lab

/10

You might also like