在取平方根后检查有理数或无理数 [英] check the rational or irrational numbers after we take the square root

查看:110
本文介绍了在取平方根后检查有理数或无理数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们取平方根后,我试图检查理性数字或无理数。我没有得到公式。例如。 64的平方根是8,这是理性的。平方根2是不合理的。如何在c ++中检查..

I tried to check the rational or irrational numbers after we take the square root. i dont get the formula. for eg. squareroot of 64 is 8 and it is rational. square root of 2 is irrational. how to check it in c++..

推荐答案

我记得,有理数是一个整数除以另一个整数。喜欢2/3。没有涉及平方根。请注意,2/3是有理数,但0.6666667不是因为它不是x / y形式。


除数整数不能为零。


2的平方根是不合理的,因为它不能用某些x / y表示。


所以,我不确定你在做什么。如果你的数字不是x / y的形式那么它是不合理的。
As I recall, a rational number is one integer divided by another. Like 2/3. There''s no square root involved. Note that 2/3 is a rational number but 0.6666667 is not because it is not of the form x/y.

The divisor integer cannot be zero.

The square root of 2 is irrational because it cannot be represented by some x/y.

So, I''m not sure what you are doing. If your number is not of the form x/y then it is not rational.


我知道这是不合理的,但我需要一个程序的公式来用c ++做
i know that is irrational but i need formula for a program to do it in c++


仅使用整数变量计算平方根。然后对结果进行平方并将其与原始数字进行比较。如果比较为真,则数字是合理的。


使用整数变量,2的平方根为1,当平方不等于2时。因此,2的平方根是不合理的。


请注意,64的平方根是8但是8不是有理数,因为它不是x / y形式。您需要说8/1或64/8,因为它们都是8。
Calculate your square root using only integer variables. Then square your result and compare it to the original number. If the compare is true the number is rational.

Using integer variables, the square root of 2 is 1, which when squared does not equal 2. Therefore, the square root of 2 is irrational.

Please note that the square root of 64 is 8 but 8 is not a rational number because it is not of the form x/y. You would need to say 8/1 or 64/8 since either would be 8.


这篇关于在取平方根后检查有理数或无理数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆