I need help with: getData, displayData, and getSum functions

This is a discussion on I need help with: getData, displayData, and getSum functions within the C Programming forums, part of the General Programming Boards category; hey i have a programming problem and i am unsure of what the final part is. the question is: Write ...

  1. #1
    Registered User
    Join Date
    Apr 2013
    Posts
    4

    I need help with: getData, displayData, and getSum functions

    hey i have a programming problem and i am unsure of what the final part is.
    the question is:
    Write a program that fills an array with 10 random numbers between 1 and 20, displays the 10 numbers, and finds the sum of the 10 numbers. Call the getData, displayData, and getSum functions from the main function. Output the sum from the main program by calling the getSum function within a printf statement.

    i am just really unsure of what this is--
    getData, displayData, and getSum functions from the main function. Output the sum from the main program by calling the getSum function within a printf statement.

    what i have got so far is;
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #define ARY_SIZE 10
    
    int main()
    {
        int randomNumbers[ARY_SIZE], sum = 0, i;
    
        srand (time(NULL));
    
        for(i = 0; i < ARY_SIZE; i++)
        {
            randomNumbers[i] = (rand() % ARY_SIZE) + 1;
            //printf("%d\n", randomNumbers[i]);
        }
    
        printf("\n");
    
        for(i = 0; i < ARY_SIZE; i++)
        {
            sum = sum + randomNumbers[i];
        }
    
        //printf("%d", sum);
    
        return 0;
    }

  2. #2
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,655

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WinAPI functions - similar functions as part of VS C++
    By jlewand in forum Windows Programming
    Replies: 2
    Last Post: 02-02-2012, 08:54 AM
  2. Creating Functions & passing information to other functions
    By RyanLeonard in forum C Programming
    Replies: 4
    Last Post: 10-28-2010, 01:17 PM
  3. Replies: 1
    Last Post: 04-03-2009, 09:52 AM
  4. help with void getData function
    By dragongunner in forum C++ Programming
    Replies: 3
    Last Post: 02-11-2008, 11:34 AM
  5. int GetData(unsigned char* aBuffer);
    By kpmkhaja in forum C Programming
    Replies: 4
    Last Post: 01-10-2007, 06:38 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21