CBCP2103 – PENGATURCARAAN KOMPUTER

OPEN UNIVERSITI MALAYSIA

FACULTY INFORMATION TECHNOLOGY & MULTIMEDIA COMMUNICATIONS

CBCP2103

PENGATURCARAAN KOMPUTER

KUMPULAN PC

SYAIFUL ARIEF SYAH MOHAMED SAID (

MOHD KAMIL BIN ASMUZI (

NIK MAZRUL BIN NIK ABDULLAH (

ZULKHAIR BIN ZAINAL ABIDIN (

SHAMSUL RIZAL BIN SAMAT (

NAMA TUTOR : EN. SHAMIM AHMAD BIN AMEER ALI KHAN

PUSAT PEMBELAJARAN

UIA SEKSYEN 17, PETALING JAYA

SEMESTER SEPTEMBER 2005


Soalan 1

a) Input ialah Jumlah Buah Limau yang di petik

Output Jumlah Limau untuk Owner

Jumlah Limau untuk Jus

Jumlah limau untuk setiap pekerja

b) Carta Alir

No

Yes

Start

jum_limau_owner = (jum_limau * 4) / 10

jum_limau_1 = jum_limau – jum_limau_owner

Jum_limau_jus = jum_limau_1 % 4

If jum_limau_jus > 0

Jum_limau_worker = (jum_limau_1 – jum_limau_jus) / 4

Masukkan jum_limau

 

Paparkan jum_limau, jum_limau_owner_ jum_limau_jus, jumlah_pekerja, jum_limau_worker

Paparkan jum_limau_jus

c) Pseudo Kod

1.0 Mula

2.0 Input jum_limau

3.0 Jum_limau_owner = (jum_limau * 4) /10

4.0 Jum_limau_1 = jum_limau jum_limau_owner

5.0 Jum_limau_jus = jum_limau_1 % 4

6.0 Jika jum_limau_jus > 0

7.0 Mula_Jika

7.1 Paparkan jum_limau_jus

8.0 Tamat_Jika

9.0 Jika_Tidak

10.0 Mula

10.1 Paprkan Jumlah_pekerja = 4 orang

10.2 Jum_limau_worker = (jum_limau_1 – jum_limau_jus) / 4

11.0 Tamat_Jika_Tidak

12.0 Paparkan pembahagian jumlah limau

13.0 Tamat

d) Aturcara C

#include <stdio.h>

void main() {

int jum_limau, jum_limau_worker, jum_limau_jus;

int jum_worker, jum_limau_1, jum_limau_owner;

clrscr();

printf(“Masukkan Jumlah Limau Yang Dipetik: “);

scanf(“%d”, &jum_limau);

jum_limau_owner = (jum_limau * 4) / 10;

printf(“Jumlah Limau Owner %d \n”,

jum_limau_owner);

jum_limau_1 = jum_limau – jum_limau_owner;

jum_limau_jus = jum_limau_1 % 4;

if (jum_limau_jus > 0)

printf(“Jumlah Limau Jus %d \n”,

jum_limau_jus);

printf(“Jumlah Pekerja :4 orang\n”);

jum_limau_worker = (jum_limau_1 – jum_limau_jus) /4;

printf(“Jumlah Limau Setiap Orang Pekerja %d \n”,

jum_limau_worker);

}

Soalan 2

  1. Input ialah Nilai Cek

Output Nilai Cek dalam perkataan

Nilai Cek dalam nombor

  1. Carta Alir

Yes

No

Start

Enter Number

 

(n/10000000),"crore"

(n/100000)%100),"lakh"

(((n/1000)%100),"thousand")

(((n/100)%10),"hundred")

((n%100)," ")

Paparkan Nilai Cek dalam perkataan

Tamat

If Number <0

Enter numbers greater than 0

  1. Pseudo Kod

1.0 Mula

2.0 Input Nilai Cheque

3.0 Jika Nilai < 0

4.0 Mula Jika

4.1 Paparkan” Enter numbers greater than 0”

4.2 Tamat Mula_Jika

4.0 Cetak Nilai Cheque dalam Perkataan”

5.0 Paparkan Nilai Cek dalam alphabet

6.0 Tamat

  1. Aturcara C

#include<stdio.h>

void pw(long,char[]);

char *one[]={” “,” one”,” two”,” three”,” four”,” five”,” six”,” seven”,” eight”,” Nine”,” ten”,” eleven”,” twelve”,” thirteen”,” fourteen”,” fifteen”,” sixteen”,” seventeen”,” eighteen”,” nineteen”};

char *ten[]={” “,” “,” twenty”,” thirty”,” forty”,” fifty”,” sixty”,” seventy”,” eighty”,” ninety”};

void main()

{

long n;

clrscr();

printf(“Enter the no: “);

scanf(“%9ld”,&n);

if(n<=0)

printf(“Enter numbers greater than 0”);

else

{

pw((n/10000000),”crore”);

pw(((n/100000)%100),”lakh”);

pw(((n/1000)%100),”thousand”);

pw(((n/100)%10),”hundred”);

pw((n%100),” “);

}

getch();

}

void pw(long n,char ch[])

{

(n>19)?printf(“%s %s “,ten[n/10],one[n%10]):printf(“%s “,one[n]);

if(n)printf(“%s “,ch);

}

Leave a comment

Filed under Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s