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 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 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 ....... 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 ....... 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? 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" 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. 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 ? 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... Link to comment https://forums.phpfreaks.com/topic/22060-error-in-small-code/#findComment-103156 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.