Trying to find the average of 5 numbers C

I am extremely new to programming and I am trying to find the average of 5 numbers inputted by the user and then output it back out. The only part of my code that is not working properly is calculating the average I keep getting 1 each iteration and I cannot figure out what I am doing wrong. My code is as follows:

include <stdio.h>

int main (void){

long int first,second,third,fourth,fifth;

int sum;

int mean = sum/5;

printf("Please put in five numbers\n");

scanf("%d%d%d%d%d", &first, &second, &third, &fourth, &fifth);

printf("You entered: %d %d %d %d %d\n" , first, second, third, fourth, fifth);

sum = first+second+third+fourth+fifth;

printf("The sum of the numbers you entered is %d\n",

printf("The average is %d\n",

return 0;



Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!