Xref: utzoo comp.unix.programmer:849 comp.unix.large:220 comp.bugs.misc:303 Path: utzoo!utgpu!watserv1!watmath!att!rutgers!elbereth.rutgers.edu!remus.rutgers.edu!paul.rutgers.edu!boc.rutgers.edu!mukherje From: mukherje@boc.rutgers.edu (Sanjoy Mukherjee) Newsgroups: ru.qa,comp.unix.programmer,comp.unix.large,comp.bugs.misc Subject: C program in SUN 3/50 Keywords: C Unix SUN 3/50 Message-ID: Date: 17 Jan 91 17:09:19 GMT Followup-To: ru.qa Organization: Rutgers Univ., New Brunswick, N.J. Lines: 32 hi, I have been bumped by the following piece of code. The last argument of the printf statement is giving wrong answer. Any pointers ???? Please e-mail your reply, because I donot read these newsgroups often thanx in advance -- Sanjoy Mukherjee (mukherje@paul.rutgers.edu) -------------------------------------------------------------------------- #include #include int a,b,c,d,g,e; main(argc,argv) int argc; char *argv[]; { a = atoi(argv[1]); b= atoi(argv[2]); c=atoi(argv[3]); d = ceil(((double)a)/((double)b)); g = a*b; printf("\n%d %d %d %d %d %d %d \n",a,b,c,d,d*c,g,ceil(((double)a)/((double)b))+g); } --------------------------------------------------- Compiling command : cc test.c -lm ---------------------------------- Run : a.out 1 2 3 ------------------------ Output: 1 2 3 1 3 2 1074266112 --------------------------