0

Java beginner test

Write a program that displays the Fibonnaci sequence up to a number N read from the keyboard. N = 20 0112358 13 Write a program that checks if a word is a palindrome.

15th Dec 2023, 11:07 AM
Mohamed Amandar
Mohamed Amandar - avatar
3 Antworten
+ 7
Mohamed Amandar , it is not quite clear what your question or issue is. you are asking about fibonacci series, and also about palindromes. these are different items that shoulb be handled in different threads. > for both of your requests we need to see your code to see where your issue is. > put the code in playground, save it there, create a link to it and post it here.
15th Dec 2023, 11:44 AM
Lothar
Lothar - avatar
+ 5
us giving you the code will not help you learn. You have to do it yourself. We can help you fix mistakes, but you have to make those mistakes yourself. The more mistake, the more you learn.
15th Dec 2023, 11:48 AM
Bob_Li
Bob_Li - avatar
0
import java.util.*; public class Fibo { public static int ser(int num) { int numm=num; int first=0; int sec=1; System.out.println(first +"\n" +sec); for(int i=0;i<=numm;i++) { int fib=first+sec; first=sec; sec=fib; System.out.println(fib); } return 0; } public static void main(String[] args) { Scanner scan=new Scanner(System.in); System.out.println("Enter number"); int num=scan.nextInt(); ser(num); } }
17th Dec 2023, 2:40 AM
Ragavan Kumar
Ragavan Kumar - avatar