Merlimau Polytechnic Electrical Engineering Department Ec201 - Fundamental Programming Laboratory 1 Title
Merlimau Polytechnic Electrical Engineering Department Ec201 - Fundamental Programming Laboratory 1 Title
Laboratory 1
Title:
Introduction:
Objectives :
Apparatus:
Procedure:
a) Program
b) Programmer
c) Programming language
ii) Give one example of programming language that is specially used for the following
application:
Application Programming Language
Scientific application
Business application
Artificial intelligence
Systems programming
Web software
2. Identify the inputs, processes, and outputs (IPO) for the following problems. Use the
following diagram.
ii) A hypermarket gives a 50% discount for each product purchased by its
customers due to Hari Raya Aidilfitri and Deepavali celebration. A
program will calculate the new price for a product and the total price
of all products purchased by the customers.
i) flowchart
ii) pseudocode
iii) IPO chart
iv) Structured chart
i) A program will calculate the cost of an international call from Malaysia
to Indonesia. The connection fee is RM10, RM3 for the first three
minutes and RM0.50 for each additional minute. Your program should
get the number of minutes the call lasted and the total cost.
ii) A Fibonacci number is a member of set in which each number is the
sum of the previous two numbers. The series begins:
0, 1, 1, 2, 3, 5, 8, 13, 21 ……
A program will calculates and prints the next three numbers in the
Fibonacci series.
iii) A program that can act as a calculator. The calculator program should
received two integers and the operation to be performed. It should
then output the numbers, the operator, and the result.
5. Using the Turbo C++, type the program below, compile and run the program. Students are
required to identify whether there are errors and state (if applicable) whether the errors are
syntax errors or logic errors
___________________________________________________________________________
____________________________________________
i)
include <stdio.h>
int main()
int n, count;
float y, average, sum=0;
for(count=1; count<=n;++count)
{
printf("x=");
scanf("%f", &x);
sum+=x;
}
return 0;
}
___________________________________________________________________________
______________________________________________
ii)
#include <stdio.h>
int main()
{
int sum;
___________________________________________________________________________
________________________________________________
iii)
#include <stdio.h>
main()
{
int value1, value2, sum;
value3 = 35;
value2 = 18;
sum = value1 * value2;