News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

help for simple program , can you write it?

Started by gardiyan, October 13, 2006, 07:57:33 PM

Previous topic - Next topic

gardiyan

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).

evlncrn8

#1
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

TNick

 :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

hutch--

 :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.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Tedd

Quotehelp for simple program , can you write it?
Yes I can :bdg

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


::)
No snowflake in an avalanche feels responsible.