From: "Blaine Hodge" Newsgroups: comp.os.msdos.djgpp References: <82gbc8$gq0$1 AT imsp026 DOT netvigator DOT com> Subject: Re: Whatever the input, the output is always 0 Lines: 24 X-Newsreader: Microsoft Outlook Express 4.72.3612.1700 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3612.1700 Message-ID: Date: Mon, 06 Dec 1999 13:06:16 GMT NNTP-Posting-Host: 24.113.39.3 X-Complaints-To: abuse AT home DOT net X-Trace: news1.rdc1.bc.home.com 944485576 24.113.39.3 (Mon, 06 Dec 1999 05:06:16 PST) NNTP-Posting-Date: Mon, 06 Dec 1999 05:06:16 PST Organization: @Home Network Canada To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Try scanf("%lf%lf", &a, &b); you need to pass pointers to the doubles, not the values. Jason Yip wrote in message <82gbc8$gq0$1 AT imsp026 DOT netvigator DOT com>... >whatever I input, say 4.0 5.0, the output is always =0 . why?? >pls tell me. thx.. > >#include >#include >double side (double a,double b) >{return sqrt(pow(a,2)+pow(b,2));} > >main () >{double a,b,s; >printf("Enter the sides of the triangle: "); >scanf("%lf%lf",a,b); >s=side(a,b); >printf("Hyotenuse: %.1f",s); >} > > >