打印字符串而不是斐波那契数字 [英] Print strings instead of fibonacci numbers

查看:107
本文介绍了打印字符串而不是斐波那契数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于Java Fibonacci的初学者问题。



在这个java程序中,该方法应该打印从beginIndex到LastIndex的fibonnacci数字序列,所以它应该打印嗨(而不是数字)如果数字是5的倍数,打印我是如果数字是7的倍数并打印我是我如果数字是7和5的倍数。我不是很确定关于如何做到这一点。谢谢你的帮助。





i have a beginner question on Java Fibonacci.

In this java program, The method should prints fibonnacci numbers sequence from beginIndex to LastIndex, so it should print "Hi" (instead of number) if the number is multiples of 5, print "I am" if the number is multiples of 7 and print "Hi I am me" if the number is multiples of 7 and 5. I am not really sure on how to do this. Thank you for any help.


class FibonacciClass {
    public static void main(String args[] ) throws Exception {

        generatefibonacci(10, 20);
        generatefibonacci(0, 1);

    }

    private static void generatefibonacci(int BeginIndex, int LastIndex) {

    }





我尝试过:



我已经尝试了斐波纳契序列,但我不确定如何用字符串替换数字。



What I have tried:

I have tried the fibonacci sequence, but im not really sure how to replace the numbers with strings.

推荐答案

参见 Trail:学习Java语言(Java和教程) [ ^ ]。


这篇关于打印字符串而不是斐波那契数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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