Display the numbers and compute it

clarence_cool03 -1 Tallied Votes 105 Views Share

{-='Display the numbers and compute it using Dev-C LaNGuaGe'=-}

#include <stdio.h>

#define MAX_SIZE 10

int main (void)
{
//  Local Declarations
    int i;
    int readNum;
    int numbers [10];
    int average;
    int sum;
    int max_size = 10;
    
//  Statements
    sleep(1000);
    printf("\nThis program will compute the average of the numbers you enter\n");
    printf("\a");
    sleep(1000);
    printf("\nYou may enter up to 10 integers only:\n");
    printf("\a");
    sleep(1000);
    printf("\nHow many numbers would you like to enter? ");
    printf("\a");
    sleep(1000);
    scanf("%d", &readNum);
    
    if (readNum > 10)
    readNum = 10;
    
    printf("\n You may now enter your numbers: \n");
    for ( i = 0; i < readNum; i++)
    scanf("%d", &numbers[i]);   
    
    sum += numbers;               
    average = sum / max_size;
    
    printf("the average is %d\n", average);
    sleep(1000);
    
    system("pause");
    return 0;
}// main