Skip to content

Update exercise5.c#17

Open
WongChinWee wants to merge 1 commit intoUMK-Data-Science:mainfrom
WongChinWee:patch-21
Open

Update exercise5.c#17
WongChinWee wants to merge 1 commit intoUMK-Data-Science:mainfrom
WongChinWee:patch-21

Conversation

@WongChinWee
Copy link

//documentation section
/* Exercise 5 - 2D array */

//pre-processor section
#include<stdio.h>

//global variable section

//main function section
int main(){
//write here your program

int myArray[5];
int i;
int averageVal;
int sum = 0;

for (i=0; i<5; i++){

    printf("Enter Value: ");
    scanf(" %d", &myArray[i]);
    sum = sum + myArray[i];

}

averageVal = sum / 5;

printf("Average value is: %d", averageVal);


return 0;

}

//user-defined section

//documentation section 
/* Exercise 5 - 2D array */

//pre-processor section 
#include<stdio.h>

//global variable section 


//main function section 
int main(){
    //write here your program

    int myArray[5];
    int i;
    int averageVal;
    int sum = 0;

    for (i=0; i<5; i++){

        printf("Enter Value: ");
        scanf(" %d", &myArray[i]);
        sum = sum + myArray[i];

    }

    averageVal = sum / 5;

    printf("Average value is: %d", averageVal);


    return 0;
}

//user-defined section
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant