Save
Forgot Password
Register Here
Resources
Applications
AI
Business
Components and Libraries
Computer Science
Database
Documents And Specifications
Enterprise Application Integration
Game
Hardware
Multimedia
Network
Security
Tools And Utilities
Training And Certification
Web
Languages
Assembly
Basic
C
C#
C++
Delphi
Java
JavaScript
Other Languages
Pascal
Perl
PHP
Python
Ruby
VB-Script
Visual Basic
Platforms
.NET
Browser Based
Consoles
CPU
Embedded
Java Platform
Legacy Platforms
Linux
Macintosh
Mobile Platforms
MS-DOS
Remotely Hosted
UNIX
WEB Service
Windows
Forums
Unanswered Posts
Latest Threads
Latest Posts
Programming Languages
Assembler Developer
Basic
C and C++
C#
Delphi and Kylix
Java
Pascal
Perl
PHP
Python
Ruby
VB.NET
VBA
Visual Basic
Applications
Computer Graphics
Computer Hardware
Database & SQL
Electronics development
Game programming
Matlab
Sound & Music
XML Development
Classifieds
Co-operative Projects
For sale
FreeLance Software City
Jobs Available
Jobs Wanted
Wanted
Microsoft .NET
.NET General
ASP.NET
Miscellaneous
Comments on the PH Re-design
Comments on this site
Computer Emulators
General programming
New programming languages
Off topic board
Mobile & Wireless
Palm Pilot
Multimedia
Demo programming
MP3 programming
Operating Systems & Platforms
Cloud Computing
Embedded / RTOS
FreeBSD
LINUX programming
MS-DOS
Windows CE & Pocket PC
Windows programming
Software Development
Algorithms
Object Orientation
Project Management
Quality & Testing
Security
WEB-Development
Active Server Pages
AJAX
CGI Development
ColdFusion
Flash development
HTML & WEB-Design
Internet Development
JavaScript
WEB Servers
WEB-Services / SOAP
Blogs
Blog Startpage
Latest Blog Posts
Submit
Article
Book
File
Link
News
PAD File
Wiki Article
Jobs
Dev Tools
PH
Search
Newsletter
Merchandise
Top User Lists
Getting Started Guide
Help
Advertise
Contact Us
HOME
>
Forums
>
C/C++ on Linux/Unix
> pow(x,y) is not working
C/C++ on Linux/Unix
Moderators:
Lundin
Number of threads:
314
Number of posts:
633
With full replies
Topics only
C/C++ on Linux/Unix
Forum Info
This Forum Only
Single Post View
Linear View
Threaded View
f
Printer Friendly
RSS Feed
pow(x,y) is not working
Posted by
krishnampkkm
on 10 Dec 2009 at 10:12 PM
Hiii
I tried to write a small program in C.
#include<stdio.h> #include<math.h> int main() { printf("\n\n the 4^3 = %d",pow(4,3)); return 0; }
And I compile like
$gcc -lmath pgm1.c
but it doesn't work..What may be the reason.
Thanking you
Krish+
Share By Email
Re: pow(x,y) is not working
Posted by
bowbe
on 11 Dec 2009 at 9:45 PM
It compiles just fine without '-lmath'.
pow is expecting a return value of double, so you may want to change '%d' to something like '%.0f'. (testing it with %d showed 4^3=0)
Share By Email
Re: pow(x,y) is not working
Posted by
ajitreen
on 22 Feb 2011 at 2:02 AM
try this code I tried it using code blocks I use Ubuntu linux gcc4.4
include<stdio.h>
#include<math.h>
int main()
{
int a,b,c;
a=4;b=3;
c=pow(4,3);
printf("\n\n the 4^3 = %d",c);
return 0;
}
Share By Email
Re: pow(x,y) is not working
Posted by
siva_developer
on 29 Oct 2012 at 9:03 PM
its working fine in gcc , just check by compiling with gcc name.c and ./a.out
no need to use -lpm
Share By Email
Re: pow(x,y) is not working
Posted by
ajitreen
on 22 Feb 2011 at 2:09 AM
try this code I tried it using code blocks I use Ubuntu linux gcc4.4
include<stdio.h>
#include<math.h>
int main()
{
int a,b,c;
a=4;b=3;
c=pow(4,3);
printf("\n\n the 4^3 = %d",c);
return 0;
}
Share By Email
Recent Jobs
Home
About PH
Privacy Statement
Hosted SubVersion
Hosted Bugtracker
Contact Us
Advertise Here
Official Programmer's Heaven Blogs
Web Hosting
|
Browser and Social Games
|
Gadgets
Popular resources on Programmersheaven.com
Assembly
|
Basic
|
C
|
C#
|
C++
|
Delphi
|
Flash
|
Java
|
JavaScript
|
Pascal
|
Perl
|
PHP
|
Python
|
Ruby
|
Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our
Terms Of Use
and
Privacy Statement
for more information.
Operated by
CommunityHeaven
, a
BootstrapLabs
company.