Jump to content

error in small code


qwe010
 Share

Recommended Posts

hi all

i Found  this code   
i Tried to compiled it   
but he show error 
It needs to be some minor adjustments 

[code]#include <stdio.h>
#include <conio.h>
float average(float ary, float count)
{
float tot = 0.0;
        int i;

        for(i = 0; i < count; i++)
                tot += ary;

        return(tot / count);
}
int main()

{

printf("\n\t\t\t****************************
printf("\t\t\t****************************
printf("\t\t\t******** L-G-H Team ********
printf("\t\t\t****************************
printf("\t\t\t****************************
printf("\t\t            the result is %f\n", average(5.5, 3.5));
printf("\t\t\t        you got it :D\n\n");
printf(" press any key to exit...

getch();
return 0;
}[/code]

please
Link to comment
Share on other sites

This is the output of the program


                        ****************************
                        ****************************
                        ******** L-G-H Team ********
                        ****************************
                        ****************************
                            the result is 6.285714
                                you got it :D

press any key to exit...



Link to comment
Share on other sites

This thread is more than a year old. Are you sure you have something important to add to it?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.