无法使用C计算给定数字的第5个根 [英] Trouble calculating 5th root of a given number using C
问题描述
嗨朋友
请帮我编写一个C程序来查找给定数字的第五(第五)根。
Ex:(1 )输入:32
输出:32的第5根是2
例如:(1)输入:243
输出: 243的第5根是3
点击此处: www .c4swimmers.esmartguy.com 测试你的C编程优势。
等待你的回复。
问候
Kishor
" Kishor" < NA *********** @ rediffmail.com>在消息中写道
news:84 ************************* @ posting.google.co m ... < blockquote class =post_quotes>嗨朋友们
请帮我写一个C程序来查找
给定数字的第5(第五)根。例:(1)输入:32
输出:32的第5根是2
例如:(1)输入:243
输出:243的第5根是3 />
点击此处: www.c4swimmers.esmartguy.com 进行测试你的C编程
优势。
等待你的回复。
问候
Kishor
是否允许使用标准math.h?
如果是,那么
double result = pow(32,1 / 5);
应该给你2.0
Allan
Allan Bruce写道:
Kishor < NA *********** @ rediffmail.com>在消息中写道
新闻:84 ************************* @ posting.google.co m ...嗨朋友们
请帮我编写一个C程序来查找给定数字的第5(第5)个根。Ex:(1)输入:32
输出:32的第5根是2
Ex:(1)输入:243
输出:243的第5根是3
点击这里: www.c4swimmers.esmartguy.com 测试您的C编程
优点。
我通过DS9K运行了一些代码,现在到处都有鼻子
恶魔:-)
等待你的回复。
问候
Kishor
是否允许使用标准数学.h?
如果是这样,那么
双结果= pow(32,1 / 5);
应该给你2.0
幸运的是,它给我1.0预期:-)也许你的意思是这个?:
double result = pow(32,1 / 5。);
-nrk。
Allan
-
删除电子邮件的devnull
" Allan Bruce" <人***** @ TAKEAWAYf2s.com>在消息中写道
news:bv ********** @ news.freedom2surf.net ...
" Kishor" < NA *********** @ rediffmail.com>在消息中写道
新闻:84 ************************* @ posting.google.co m ...嗨朋友们
请帮我编写一个C程序来查找
给定数字的第五(第五)根。例:(1)输入:32
输出:32的第5根是2
例如:(1)输入:243
输出:243的第5根是3 />
点击此处: www.c4swimmers.esmartguy.com 进行测试你的C编程
优势。
等待你的回复。
问候
Kishor
是否允许使用标准math.h?
如果是,那么
double result = pow(32,1 / 5);
应该给你2.0
或者至少1.0。尝试1.0 / 5.0。
这种方法足以完成家庭作业,
但不是工业强度。
PJ Plauger
Dinkumware,Ltd。
http:// www.dinkumware.com
Hi Friends
Please help me to write a C program to find the 5th (fifth) root of a given number.
Ex:(1) Input : 32
Output : 5th root of 32 is 2
Ex:(1) Input : 243
Output : 5th root of 243 is 3
Click here : www.c4swimmers.esmartguy.com to Test Your C Programming Strengths.
Waiting for your reply.
Regards
Kishor
"Kishor" <na***********@rediffmail.com> wrote in message
news:84*************************@posting.google.co m...Hi Friends
Please help me to write a C program to find the 5th (fifth) root of a given number. Ex:(1) Input : 32
Output : 5th root of 32 is 2
Ex:(1) Input : 243
Output : 5th root of 243 is 3
Click here : www.c4swimmers.esmartguy.com to Test Your C Programming Strengths.
Waiting for your reply.
Regards
Kishor
Is one allowed to use the standard math.h ?
If so, then
double result = pow(32, 1/5);
should give you 2.0
Allan
Allan Bruce wrote:
"Kishor" <na***********@rediffmail.com> wrote in message
news:84*************************@posting.google.co m...Hi Friends
Please help me to write a C program to find the 5th (fifth) root of a given number.Ex:(1) Input : 32
Output : 5th root of 32 is 2
Ex:(1) Input : 243
Output : 5th root of 243 is 3
Click here : www.c4swimmers.esmartguy.com to Test Your C Programming
Strengths.
I ran some of the code there through the DS9K, and now there are nasal
demons all over the place :-)
Waiting for your reply.
Regards
Kishor
Is one allowed to use the standard math.h ?
If so, then
double result = pow(32, 1/5);
should give you 2.0
Fortunately, it gives me 1.0 as expected :-) Perhaps you meant this?:
double result = pow(32, 1/5.);
-nrk.
Allan
--
Remove devnull for email
"Allan Bruce" <al*****@TAKEAWAYf2s.com> wrote in message
news:bv**********@news.freedom2surf.net...
"Kishor" <na***********@rediffmail.com> wrote in message
news:84*************************@posting.google.co m...Hi Friends
Please help me to write a C program to find the 5th (fifth) root of a
given number.Ex:(1) Input : 32
Output : 5th root of 32 is 2
Ex:(1) Input : 243
Output : 5th root of 243 is 3
Click here : www.c4swimmers.esmartguy.com to Test Your C Programming
Strengths.
Waiting for your reply.
Regards
Kishor
Is one allowed to use the standard math.h ?
If so, then
double result = pow(32, 1/5);
should give you 2.0
Or 1.0 at the very least. Try 1.0/5.0.
This approach is good enough for a homework assignment,
but not industrial strength.
P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com
这篇关于无法使用C计算给定数字的第5个根的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!