Professional Documents
Culture Documents
1. /*
2. List Odd Numbers Java Example
3. This List Odd Numbers Java Example shows how to find and list odd
4. numbers between 1 and any given number.
5. */
6.
7. public class ListOddNumbers {
8.
9. public static void main(String[] args) {
10.
11. //define the limit
12. int limit = 50;
13.
14. System.out.println("Printing Odd numbers between 1 and " + limit);
15.
16. for(int i=1; i <= limit; i++){
17.
18. //if the number is not divisible by 2 then it is odd
19. if( i % 2 != 0){
20. System.out.print(i + " ");
21. }
22. }
23. }
24. }
class PrimeNumbers
{
public static void main (String[] args)
{
int i =0;
int num =0;
//Empty String
String primeNumbers = "";
package crunchify.com.tutorials;
import java.util.Scanner;
/**
* @author Crunchify.com
*
*/
public class CrunchifyFibonacci {
@SuppressWarnings("resource")
public static void main(String args[]) {
}
return fibonacci; // Fibonacci number
}
import java.util.*;
class Palindrome
{
public static void main(String args[])
{
String original, reverse = "";
Scanner in = new Scanner(System.in);
if (original.equals(reverse))
System.out.println("Entered string is a palindrome.");
else
System.out.println("Entered string is not a palindrome.");
}
}