Monday, April 18, 2016

Fibonacci Series and Palindrome Number programs

class Fibonacci {
public static void main(String[] dataBag){
int ans = 0 ;
int prev = ans;
int next = 1;

do{

System.out.println(prev);
ans = prev + next;
prev = next;
next = ans;
}while(prev<=25);
}
}


class Palindrom{
public static void main(String[] dataBag){
int number = 12121;
int palindrom = 0;
int temp = number;

while(temp>0){
palindrom = palindrom*10;
int digit = temp%10;
palindrom += digit;
temp = temp / 10;
}

if(number == palindrom){
System.out.println(number+" is a palindrom number");
}else{
System.out.println(number+" is not palindrom number");
}
}
}

No comments:

Post a Comment

Scrum and Scrum master

Scrum  Scrum is a framework which helps a team to work together.  It is like a rugby team (the scrum name comes from rugby game). Scrum enco...