CrazyEngineers
  • [FONT="]1. [/FONT]Write a complete program based on the following requirements.
    In main( ) function: · Ask the user to enter 10 integer numbers.
    · Determine the largest and smallest number among the 10 integer numbers.
    · Display the largest and smallest integer
    · Use a while(…) loop for this question.

    [TABLE="class: MsoNormalTable"]
    [TR]
    [TD="width: 529"] [FONT="]Please enter 10 numbers[/FONT]
    [FONT="]-----------------------[/FONT]
    [FONT="] [/FONT]
    [FONT="]Number 1 : 12[/FONT]
    [FONT="]Number 2 : 5[/FONT]
    [FONT="]Number 3 : 7[/FONT]
    [FONT="]Number 4 : 8[/FONT]
    [FONT="]Number 5 : 6[/FONT]
    [FONT="]Number 6 : 18[/FONT]
    [FONT="]Number 7 : 25[/FONT]
    [FONT="]Number 8 : 35[/FONT]
    [FONT="]Number 9 : 4[/FONT]
    [FONT="]Number 10 : 19[/FONT]
    [FONT="] [/FONT]
    [FONT="]The largest number is 35[/FONT]
    [FONT="]The smallest number is 4[/FONT]
    [/TD]
    [/TR]
    [/TABLE]
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • Whats In Name

    MemberAug 1, 2011

    Providing a direct solution will not help you further.I can explain you the working of the code,but you should yourself code it.

    -For inputting 10 numbers from the user,you should think of something which can store values of same datatype,you can use arrays for this.
    -Determining largest and smallest number can be solved by something related to comparisons.You can assume one number to be largest and then compare it with the next number and update the value for "largest".Do same for finding the smallest.
    -While loop will help you write a optimized code for comparison.

    Try it,if it not helps,you will be hinted more.
    Are you sure? This action cannot be undone.
    Cancel
  • PraveenKumar Purushothaman

    MemberAug 2, 2011

    Yeah, the code is ready, an optimized one... Do try out your stuff. If not able to, I will post it... I used two variables here... 😀 And an array.. 😛
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register