rss
Twitter Delicious Facebook Digg Stumbleupon Favorites
Showing posts with label value. Show all posts
Showing posts with label value. Show all posts

Saturday, October 8, 2011

A program to Swap the values


class SwapTheValues{
      public static void main(String args[]){
      int num1 = Integer.parseInt(args[0]);
      int num2 = Integer.parseInt(args[1]);
      System.out.println("\n***Before Swapping***");
      System.out.println("Number 1 : "+num1);
      System.out.println("Number 2 : "+num2);
      //Swap logic
      num1 = num1 + num2;
      num2 = num1 - num2;
      num1 = num1 - num2;
      System.out.println("\n***After Swapping***");
      System.out.println("Number 1 : "+num1);
      System.out.println("Number 2 : "+num2);
      }
}

Friday, October 7, 2011

A program that will read a float type value

class ValueRead{

  public static void main(String args[]){
       double i = 34.32;
System.out.println("Small Int. not greater than the no. : "+Math.ceil(i));
    System.out.println("Given Number : "+i);
System.out.println("Largest Int. not greater than the no. : "+Math.floor(i));
  }
Powered by Blogger.