Thread: Find smallest and largest Number of Array.

  1. #1
    Registered User
    Join Date
    Nov 2015
    Posts
    1

    Thumbs up Find smallest and largest Number of Array.

    Hello C community!

    Im very new to programming and english isnt my native language so forgive me if i make spelling errors...

    I would appreciate it very much if you guys could help me out with this task im working on at the moment.

    The task: "Write a C Programm, which allows the user to write at least 80 numbers into the console and then gives out the largest and the smallest of the injected numbers.
    When the user enters the letter "q", the programm has to stop."


    I uploaded a picture of my code i "developed" so far :
    Would be great if you guys could take a look at it.

    And like i mentioned above, i just started studying IT/Programming and havent worked with Arrays at all yet.
    This task was volunteer work but since i really enjoy programming so far i thought iŽd give it a try.
    Find smallest and largest Number of Array.-code-2-png


    The Programm stops scanning when the user enters "q" but then doesnt give out the correct numbers.



    I appreciate every little help you guys can give me.

    Thanks for reading!
    Last edited by Kexplx; 11-02-2015 at 04:59 PM.

  2. #2
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,739
    "q" is not a number... scanf with "%d" fails when you give "q". Check what scanf returns and if it is zero, break out of the loop. You also need to save how many numbers have been given, since that trick you're trying doesn't work.
    Devoted my life to programming...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 05-06-2015, 08:54 PM
  2. How to correct code to find the largest and smallest #
    By tlxxxsracer in forum C Programming
    Replies: 4
    Last Post: 03-13-2015, 10:07 AM
  3. Replies: 3
    Last Post: 01-30-2013, 09:30 AM
  4. Find the Largest and Smallest Number
    By Nightsky in forum C Programming
    Replies: 27
    Last Post: 09-04-2006, 03:40 PM
  5. Replies: 2
    Last Post: 09-05-2004, 07:13 AM

Tags for this Thread