c素数的清晰程序 [英] c sharp program for primenumbers

查看:41
本文介绍了c素数的清晰程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,

我在采访中遇到了一个问题....
\
1)
查找输入的值是否是质数......?


2)递归阶乘

3)斐波那契系列...
请任何人帮我解决这些程序...



i have faced a question in interview that....
\
1)
finding the entered value is primenumber or not......?

and
2)Recursive Factorial

3)fibonacci series...
pls any one help me for these programs......

推荐答案

Google可能是这类问题的最佳选择……..
Google can be best place for these type of questions........


尝试googlin亲爱的,
递归阶乘 [斐波那契数列 [
Try googlin dear,
Prime Number[^]
Recursive Factorial[^]
Fibonacci Series[^]


逻辑:
素数:

使用modulos(%)运算符查找余数.如果余数为0且不止一个数字,则该数字不是质数,否则为质数.

递归阶乘:

将数字乘以小于该数字的数字(最多1)

对于斐波那契数列:

加0-1以获得系列中的第三个数字,然后将结果和上一个数字相加以获得第四个数字,像这样继续...


我认为您会在这方面做得最好……最好的
just take the logic:
for prime number:

use modulos(%) operator to find the remainder. If the remainder is 0 for more than one number then the number is not a prime number otherwise number is prime.

for Recursive factorial:

multiply the numbers less than that number (upto1)

for fibonacci series:

add 0&1 to get the 3rd number in the series,then add the result & previous number to get the 4th number, like this continue...


I think u will do best with this much......all the best


这篇关于c素数的清晰程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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