Question:

I need help in this program.. why does it not show the right remainder?? o.0 heLp. . . . . pleaSe. . . .?

by  |  earlier

0 LIKES UnLike

include <stdio.h>

int average();

int main()

{

float ave;

ave=average();

printf("\n\nAverage of five nos. is %.2f", ave );

getchar();

getchar();

return 0;

}

int average()

{

int count=1, sum=0, a;

float ave;

while (count<=5)

{

printf("Enter a number: ");

scanf("%d", &a);

sum+=a;

count++;

}

--count;

ave=(sum/count);

return ave;

}

 Tags:

   Report

1 ANSWERS


  1. You&#039;ve typed your average() function as int whereas it should be float.

    change

    int average(){ ...}

    to

    float average(){...}

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.
Unanswered Questions