The MASM Forum Archive 2004 to 2012

General Forums => The Laboratory => Topic started by: gardiyan on October 13, 2006, 07:57:33 PM

Title: help for simple program , can you write it?
Post by: gardiyan on October 13, 2006, 07:57:33 PM
Write a program which asks the user to enter two digit positive integers. The user will enter the numbers consecutively (By pressing enter after each number). When the user presses enter without entering another number, the program will

- display the average of the entered numbers

- display the numbers that are below the average.

A sample run will be:



Enter the numbers:

12 (enter)

34 (enter)

55 (enter)

47 (enter)

99 (enter)(enter)



Average:

49

The numbers below the average:

12,34,47



The number of entered numbers will not exceed 255. The results will be integer, so you may round down the results.

HINTS:

- Use a counter to determine how many numbers are entered. Each time a new number is entered, the counter should increase by one.

- Each time an input is entered, check the number of characters in that input, if it is zero that means two consecutive enters are pressed and the program should stop asking for inputs and make the calculations.

- The instructions AAD and AAM may be helpful for ASCII to/from hexadecimal conversion.

- Notice that the sum of the entered numbers will fit into a word (it will not exceed FFFFh).
Title: Re: help for simple program , can you write it?
Post by: evlncrn8 on October 13, 2006, 09:22:16 PM
if (user_asking_for_homework_to_be_done) {
      slap_user_with_a_big_stick();
}

if (user_did_not_read_the_faq_especially_the_part_about_homeworks) {
     slap_user_repeatedly_with_the_faq();
}


i guess you get 2 beatings ;p :tdown
Title: Re: help for simple program , can you write it?
Post by: TNick on October 14, 2006, 09:52:32 AM
 :bdg :bdg :bdg :bdg :bdg :bdg
Quote from: evlncrn8 on October 13, 2006, 09:22:16 PM
if (user_asking_for_homework_to_be_done) {
slap_user_with_a_big_stick();
}

if (user_did_not_read_the_faq_especially_the_part_about_homeworks) {
slap_user_repeatedly_with_the_faq;
}

Good app, evlncrn8!

Regards,
Nick
Title: Re: help for simple program , can you write it?
Post by: hutch-- on October 14, 2006, 10:53:50 AM
 :bg

I guess it has all been said, we have that rule to ensure that no-one dumps their homework assignments on the members. If you REALLY want to do thjis instead of learning your course work, go to Rent A Coder and PAY for it but you will learn nothing for having bothered.
Title: Re: help for simple program , can you write it?
Post by: Tedd on October 15, 2006, 02:23:53 PM
Quotehelp for simple program , can you write it?
Yes I can :bdg

QuoteWrite a program which ..........................
Okay, I wrote it, now what?


::)