Thread View: ru.qa
1 messages
1 total messages
Started by Sanjoy Mukherjee
Thu, 17 Jan 1991 17:09
C program in SUN 3/50
Author: Sanjoy Mukherjee
Date: Thu, 17 Jan 1991 17:09
Date: Thu, 17 Jan 1991 17:09
32 lines
1369 bytes
1369 bytes
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 <math.h>
#include <stdio.h>
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
--------------------------
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads