class FibonacciNumbers
{
public static void main(String[] args)
{
System.out.println("Hello World!");
if(ContainNumber.onlyNumbers(args[0])){
int number = Integer.parseInt(args[0]);
int num1;
int num2= 0;
int num3 = 1;
while(number>0){
System.out.println(" F Series : " + num2);
num1 = num2;
num2= num3;
num3 = num1+num2;
number--;
}
}
}
}
Tuesday, August 18, 2009
//Program to Find Factorial of given number
class FindFactorial
{
public static void main(String[] args)
{
if(ContainNumber.onlyNumbers(args[0])){
int number = Integer.parseInt(args[0]);
int result = 1;
while(number>0){
result = result*number;
number--;
}
System.out.println("Factorial of given number : " + result);
}
else{
System.out.println("Enter number is not positive integer");
}
}
}
{
public static void main(String[] args)
{
if(ContainNumber.onlyNumbers(args[0])){
int number = Integer.parseInt(args[0]);
int result = 1;
while(number>0){
result = result*number;
number--;
}
System.out.println("Factorial of given number : " + result);
}
else{
System.out.println("Enter number is not positive integer");
}
}
}
Friday, August 14, 2009
programe Compare Two No
import java.io.*;
class CompareTwoNo{
public static void main(String[] args) {
try{
int num1 = Integer.parseInt(args[0]);
int num2 = Integer.parseInt(args[1]);
if(num1'/<'/num2){
System.out.println("Number " + num1 +" <" + " Number " +num2);
}
else
{
System.out.println("Number " + num1 +" >" + " Number " +num2);
}
}
catch(Exception ex){
ex.printStackTrace();
}
}
}
class CompareTwoNo{
public static void main(String[] args) {
try{
int num1 = Integer.parseInt(args[0]);
int num2 = Integer.parseInt(args[1]);
if(num1'/<'/num2){
System.out.println("Number " + num1 +" <" + " Number " +num2);
}
else
{
System.out.println("Number " + num1 +" >" + " Number " +num2);
}
}
catch(Exception ex){
ex.printStackTrace();
}
}
}
Subscribe to:
Posts (Atom)