C PROGRAMMING
AHMAD HAZIM BIN MOHD ROSLI
5 DECEMBER 2016
01DEM16F2013
EN. AZHAR
3 Problem Life.
Masak Telur Goreng
1. Start
2. Panaskan kuali
3. Pecahkan telur
4. Masukkan telur
5. Makan
6. End
Basuh Baju
1. Start
2. Sediakan air dalam baldi
3. Masukkan sabun basuh baju
4. Masukkan baju dan seluar kotor
5. Basuh
6. End
Gosok Gigi
1. Start
2. Sediakan air dalam cawan
3. Ambil berus gigi
4. Letakkan ubat gigi
5. Gosok gigi
6. End
PSEDUO CODE
Construct an algorithm
C=a+b
Step 1:
Write down process
C=a+b
Step 2:
Identify variable
Process C=a+b
Input a,b;
Output C;
Step 3:
Pseduo Code
1. Start
2. Declaration data a,b,C;
3. Input data a,b;
4. Storage data a,b;
5. Process C=a+b
6. Display output C;
7. End
Question Step 3
b.i)
d=a-b 1. Start
2.
Declaration data d,a,b;
3. Input
data a,b;
Step 1 4. Storage
data a,b;
1. Write process 5. Process
d=a-b
6. Display
output d;
d=a-b 7. End
I/p
O/p
2. Identify variables
d=a-b
1 2 3
3. Identify Output and Input
d=a-b
Input : a,b;
Output : d;
Step 2
Input : a,b;
Output : d;
Process d=a-b
Question Step 3
b.ii)
t=v/b 1. Start
2.
Declaration data t,v,b;
3. Input
data v,b;
Step 1 4. Storage
data v,b;
4. Write process 5. Process
t=v/b
6. Display
output t;
t=v/b 7. End
I/p
O/p
5. Identify variables
t=v/b
1 2 3
6. Identify Output and Input
t=v/b
Input : v,b;
Output : t;
Step 2
Input : v,b;
Output : t;
Process t=v/b
Question Step 3
b.iii)
c=3.142*r*r 1. Start
2.
Declaration data c,r;
3. Input
data r;
Step 1 4. Storage
data r;
7. Write process 5. Process
c=3.142*r*r
6. Display
output c
c=3.142*r*r 7. End
I/p
O/p
8. Identify variables
c=3.142*r*r
1 2
9. Identify Output and Input
c=3.142*r*r
Input : r;
Output : c;
Step 2
Input : r;
Output : c;
Process c=3.142*r*r
Question Step 3
b.i)
sum 2 variables 1. Start
2.
Declaration data d,a,b;
3. Input
data a,b;
Step 1 4. Storage
data a,b;
10. Write process 5. Process d=a-
b
6. Display
output d;
d=a-b 7. End
I/p
O/p
11. Identify variables
d=a-b
1 2 3
12. Identify Output and Input
d=a-b
Input : a,b;
Output : d;
Step 2
Input : a,b;
Output : d;
Process d=a-b