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");
}
}
}
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