0% found this document useful (0 votes)
30 views2 pages

Lab 1

Uploaded by

Trismegistus
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views2 pages

Lab 1

Uploaded by

Trismegistus
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

DOKUZ EYLÜL UNIVERSITY

Faculty of Engineering
Electrical and Electronics and Engineering

Dokuz Eylül Üniversitesi, Mühendislik Fakültesi,


Elektrik Elektronik Mühendisliği, TR-35160, Kaynaklar, Buca/İzmir 0090/232/ 301-7155

EED1005 Introduction to Programming Laboratory 1

Objectives(s)
1. Basic input output operations in C.

Equipment(s)
1. A personal computer on which a suitable C compiler and editor are installed.

Preliminary Work
Note: Preliminary work tasks are required to be done before the laboratory sessions and a
preliminary work report must be uploaded to both of the course websites before its deadline.
1. Write a C program that takes a value x from the user. The program then evaluates y
as shown in (1) and prints y on the console. A sample output is given in Figure 1
5
y= (1)
7x3 − 5x2+ 12x − 1

Figure 1: Preliminary task 1 sample output.

2. Write a C program that prints the pattern in Figure 2 on the console by using printf
function and * characters (use the space character for empty places).

Laboratory Work
Note: Laboratory work tasks are done during laboratory sessions, however it is strongly
recommended that students should study the tasks before the laboratory hours. After the
laboratory session, a laboratory report must be uploaded to both of the course websites
before its deadline.

1
Figure 2: Preliminary task 2 sample output.

1. Write a C program that asks the user to enter a student’s first midterm, second midterm
and final exam grades one by one. The program then evaluates the average grade of
the student using the formula in (2) and prints the average grade on the console. A
sample output of the program is given Figure 3

grade = 0.2 ∗ midterm1 + 0.2 ∗ midterm2 + 0.6 ∗ f inal (2)

Figure 3: Laboratory task 1 sample output.

2. Write a C program that asks the user to enter distance in units of miles, weight in
units of pounds and temperature in units of celsius. The program then performs the
following conversions and prints them on the screen. A sample output of the program
is shown in Figure 4.

1 kilometers = 0.6214 miles (3)


1 kilograms = 2.2205 pounds (4)
9
1 fahrenheits = celsius + 32 (5)
5

Figure 4: Laboratory task 2 sample output.

You might also like