qwe010 Posted September 26, 2006 Share Posted September 26, 2006 hi alli 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 Quote Link to comment https://forums.phpfreaks.com/topic/22060-error-in-small-code/ Share on other sites More sharing options...
qwe010 Posted September 26, 2006 Author Share Posted September 26, 2006 Youth I deleted this code [quote]\n");[/quote]Because the forum do not accept Quote Link to comment https://forums.phpfreaks.com/topic/22060-error-in-small-code/#findComment-98706 Share on other sites More sharing options...
qwe010 Posted September 26, 2006 Author Share Posted September 26, 2006 up ....... Quote Link to comment https://forums.phpfreaks.com/topic/22060-error-in-small-code/#findComment-98885 Share on other sites More sharing options...
qwe010 Posted September 26, 2006 Author Share Posted September 26, 2006 up ....... Quote Link to comment https://forums.phpfreaks.com/topic/22060-error-in-small-code/#findComment-99319 Share on other sites More sharing options...
shivabharat Posted October 1, 2006 Share Posted October 1, 2006 The code is running perfectly fine provided you have closed all the printf statements. Whats is the error you get? Quote Link to comment https://forums.phpfreaks.com/topic/22060-error-in-small-code/#findComment-101893 Share on other sites More sharing options...
qwe010 Posted October 2, 2006 Author Share Posted October 2, 2006 the errorerror.c: In function `average':error.c:8: error: syntax error before "i"error.c: In function `main':error.c:21: error: stray '\' in programerror.c:21: error: syntax error before "n" Quote Link to comment https://forums.phpfreaks.com/topic/22060-error-in-small-code/#findComment-102182 Share on other sites More sharing options...
shivabharat Posted October 2, 2006 Share Posted October 2, 2006 Hummm very strange which compiler are you using. I tried using Visual Studio 6.0 and no errors. Quote Link to comment https://forums.phpfreaks.com/topic/22060-error-in-small-code/#findComment-102441 Share on other sites More sharing options...
qwe010 Posted October 3, 2006 Author Share Posted October 3, 2006 i compiled under linux I[quote] tried using Visual Studio 6.0 and no errors[/quote]thin what the resault ? Quote Link to comment https://forums.phpfreaks.com/topic/22060-error-in-small-code/#findComment-102923 Share on other sites More sharing options...
shivabharat Posted October 3, 2006 Share Posted October 3, 2006 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... Quote Link to comment https://forums.phpfreaks.com/topic/22060-error-in-small-code/#findComment-103156 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.