i gues atul is crkt..... its jst printin by user convenience...when actually d two are not equal...
i guess the code...xplains well...dats y "equal " is not printed..out #include<stdio.h>int main(){ double p=fabs(24.9996); printf("%lf\n",p); double t=fabs(25.0003); printf("%lf\n",t); printf("%0.3lf %0.3lf\n",p,t); printf("%lf\n%lf\n",fabs(p),fabs(t)); if(fabs(p)==fabs(t)) printf("equal");// why this not executed?} crkt me if i'm wrong.. Regards, PAYAL GUPTA, NIT-BHOPAL.. On Tue, Jan 17, 2012 at 12:13 PM, shady <sinv...@gmail.com> wrote: > atul he is assigning the value later on. > i think format specifier . rounds up the number in last decimal place. > > > On Tue, Jan 17, 2012 at 11:53 AM, atul anand <atul.87fri...@gmail.com>wrote: > >> printf("%0.3lf %0.3lf\n",p,t); >> >> its just printing at your convenience . you are not changing the value of >> p,t . >> change this statement to >> printf("%0.5lf %0.5lf\n",p,t); >> >> >> >> >> On Tue, Jan 17, 2012 at 11:27 AM, dabbcomputers >> <dabbcomput...@gmail.com>wrote: >> >>> #include<stdio.h> >>> int main() >>> { >>> double p=fabs(24.9996); >>> double t=fabs(25.0003); >>> printf("%0.3lf %0.3lf\n",p,t); >>> if(fabs(p)==fabs(t)) >>> printf("equal");// why this not executed? >>> } >>> >>> >>> why the "equal" not printed in this code...? >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Algorithm Geeks" group. >>> To post to this group, send email to algogeeks@googlegroups.com. >>> To unsubscribe from this group, send email to >>> algogeeks+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.