Jump to content
Sign in to follow this  
putera_ranggi

Camner Nak

Recommended Posts

aku ado prob ni

lec aku suruh aku buat satu aturcara

dia bagi 7 input nombor

sebagai contoh

a = 10

b = 69

c = 45

d = 98

e = 54

f = 39

g = 20

lepas tu kena cari hasil tambah tak termasuk yang paling tinggi dan yang paling rendah

jadi prob aku nyer

camner aku nak setelkan prob tu

blink.gif

Share this post


Link to post
Share on other sites

compare semua nombor.. one by one.. lepas tu ko akan dapat sort nombor2 tu dari kecik hingga paling besar

lepas tu add semua no kecuali kecik dan besar..

hints:

guna array and temporary variable

Share this post


Link to post
Share on other sites

guna stack based array je.

int rawnum[7];

pastu baca camner nak guna bubble-sort sana(memerlukan 2 gelung for).

pastu lagi sekali gelung for utk totalkan sumer nombor dlm array[7] tak

termasuk yg ~paling besar[6] dgn yg ~terkecik[0], miahaha unsure.gif

Edited by raihan

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...