Saturday, June 26, 2010

3 idiots In CID style





After Rancho suddenly disappears from ICE, Raju and Farhan Decide to call the world famous CID.

ACP: Ohh MY GODD !!! Rancho Gayab hai !! Abhijeet, Daya...campus ko acchi tarah se CHECK KARO !! Woh zaroor koi na koi suraag chhod gaya hoga !! (Shaking his finger)
(After searchin the campus like a pair of buffoons...Abhijeet and Daya find out that Joy had committed suicide 4 years back in the campus...)

Abhijeet: Sir, Mamla Gadbad hai...Yaha kisi joy naam ke student NE aatma-hatya ki thi 4 saal pehle. Lagta hai woh aatma hatya nahi...khoon tha...aur shayad khooni yeh Rancho hi hoga !!!

ACP: OHH MY GODD !!!

ACP: Yeh joy ki kabar khod ke uski laash bahar nikalo...aur use forensic lab me leke aao...Dr. Salunkhe zarur koi na koi baat ughalva denge iss murde aadmi se !!
(after fredricks does all the digging and brings out the dead body of joy...and the next scene is of the forensic lab)

Dr. Salunkhe: ACP, bahot jaldi laash laaye tum...isse kuch bulvana mushkil hoga...lekin tum tension mat lo...tum Dr. Salunkhe ke lab se khali haat nahi jaoge..koi na koi raaz toh pata chal hi jayega
(after playin with some colour changing liquids)

Dr. Salunkhe : BOSS...tumne kaha isski maut suicide se hui hai...main kehta hu..iska khoon hua hai !!

ACP: Salunkhe !!! Mazaak ka waqt nahi hai !!...yeh kaise ho sakta hai??

Salunkhe: BOSS...sab kuch mumkin hai !! Yeh dekho...(shows him his star-trek type computer and does some really fast typing)

ACP: OHH MY GODD !! (still shaking his finger)....toh phir yeh baat hamein kisi NE batayi kyu nahi ??...ek kaam karo...uss principal ko yahaan leke aao bureau me...AB kya sach hai..wahi hamein batayega !!
(virus is brought to the bureau)

Virus: Sssir, mujhe yahaan kyun bulaya hai...Maine kuch nahi kiya

Abhijeet: sach sach batao...uss raat campus me kya hua tha???

Virus: sssir, main sssach bol raha hu...mujhe kuch nahi pata hai??
(daya gives him his special CHAMAAAT !!!)

Daya: Ab yaad aaya kuch???

Virus: Haan Sir, sab yaad AA gaya...Bata ta hu...sab Bata ta hu !

Fredricks: (constipated look)..sir.. daya sir ke chamaat me toh jaadu hai...iska 'sssss' kehna band ho gaya

ACP: Fredricks..chup raho !!

Virus: uss raat sab logo NE gay party ki thi....sab log apni underwear me campus me ghoom rahe the....main bhi tha...lekin mere saath koi flirt hi nahi kar raha tha...isliye main bahot gusse me tha...phir Joy aaya aur usne mujhe uska helicopter dikhaya...Maine uska helicopter gutter me fek diya..toh woh rote rote apne room me chale gaya. Aur next din humne dekha toh uska murder ho gaya tha...lekin aap please yeh baat kisi se boliye mat...college ki badnaami ho jayegi...

ACP: hum kisi ko nahi batayenge... tum hamare saath co-operate karo
(virus leaves)

ACP: yahaan kuch toh gadbad hai daya....aisa kaise ho sakta hai ki campus me khoon ho gaya aur kisi NE CID ko bulaya hi nahin??

Abhijeet: sir shayad logo ko pata hai...ki pehle police ko bulana chaiye...CID ko nahi !!

ACP: Aur yeh kaise hua ki khooni campus me AA gaya..aur campus se khoon kar ke nikal gaya??

Vivek : Sir, shayad yeh bhi ho sakta hai ki khooni koi student hi ho?

ACP: haan vivek...kuch bhi ho sakta hai...kuch bhi (shaking finger)..ek kaam karo abhijeet...phir se campus me chalte hain...aur acchi tarah se check karte hain...yahaan daal me kuch kaala hai !!

Abhijeet: sir daal me kala nahi...puri daal mere jaisi kaali hi hai !!
(they reach the campus in their ol' faithful qualis which changes colour every episode...but the number plate is still the same...and daya slams the breaks....SCCHRREEE ECH !!)

ACP: Abhijeet, Vivek tum pura campus CHECK KARO....Daya tum iss campus ke saare DARWAAZE TOD DO !!....Fredricks. ..tum sab logo ko tumhare jokes se entertain karo...aur main yahaan baith ke apni ungli hilata hu....chalo sab apne apne kaam pe lag jaao !!
(after checking the campus)

Vivek: Sir, yahaan aiye....yeh dekho...yeh ek chatur naam ke ladke ki diary mili hai sir...isme likha hai ki woh Rancho aur Rancho ek dusre ke dushman the...aur woh Rancho se badla Lena chahta tha !!

ACP : (shaking finger...as usual)...OHH MY GODD !!! AB yeh Chatur kaun hai...aur iske room se itni baas kyun AA rahi hai !!...Good work vivek !!...iss evidence ko forensic lab Le jao !

Abhijeet: Haain !!! Sir, dheere dheere sab pata chal raha hai...shayad se iss chatur NE hi joy ka khoon kiya hoga !! Aur Rancho kahaan gaya...usse hi pata hoga !!

ACP: Toh bulao iss Chatur ko Bureau mein...isse hi pooch ke dekhte hain !!
(chatur in interrogation)

ACP: Rancho kahaan hai ??

Chatur : I Don't Know Sir !! Mujhe nahi pata !!

Abhijeet: Dekho Sach Sach Batao !! Hamein yeh diary mili hai tumhare room se...isme saaf saaf likha hai ki tumhein Rancho se jalan thi

Chatur : (over-acting) ...mujhe nahi pata hai sir !! maine kuch nai kiya hai
(Daya gives ONE TIGHT SLAP and the chair spins)

Chatur: Haan haan...maine hi khoon kiya tha joy ka...kyonki usne mechanical helicopter banaya tha project me...aur maine sirf paper ka rocket banaya tha....boo hoo hoo !! Lekin phir woh kambakht Rancho aa gaya...usne mujhe dekh liya tha...isliye maine usko bhi gayab kar diya

ACP: waah...kya plan banaya tha...lekin afsos tum CID ke saamne kamiyaab nahi ho paaye...ab banate rehna plan...JAIL me...Tumhe toh FAASI hogi FAASI !!


Friday, February 19, 2010

The nokia N70 torch

The Flash of the camera(dorsal side) can be converted to TORCH
Download it from HERE.
or

http://rapidshare.com/files/143944842/nokia_n70_torch.rar.html

NOKIA N 70

The Nokia N70 (Model N70-1)(2002) is one of the handsets in Nokia's Nseries lineup of smart phones.





It is equipped with a 2 megapixel camera with built-in flash, a front VGA camera to allow video calling, FM radio, Bluetooth, digital music player functionality, and support for 3D Symbian, Java games and other S60 2nd Edition software.
It uses the S60 user interface and the Symbian 8.1a operating system.
At the time of its launch, the N70 had the most built-in memory alongside its system memory and was the penultimate (before the related N72) Symbian OS 8.x device released by Nokia, since the introduction of their new OS9 platform released in 2003 which offers more flexibility than the original that was made in 1998 and upgraded from then on.
In 2006 Nokia released N70 Music Edition phone.
FeatureSpecification
Form factorCandy bar
Platform / Operating SystemBB5 / Symbian OS v8.1a, S60 Platform Second Edition, Feature Pack 3
CPUTexas Instruments OMAP 1710 (ARM architecture 926TEJ v5) - 220 MHz
Memory (RAM\Flash\MMC)32 MB\22 MB\up to 2GB
GSM frequencies900/1800/1900 MHz
GPRSYes, class 10 (4down/2up, max 5 active)
EDGE (EGPRS)Yes, class 10
WCDMAYes (5240MHz)
Main screenTFT Matrix, 262,144 colours, 176x208 pixels
CameraFront 0.3 Megapixel, 2x digital zoom & Rear 2.0 Megapixel with LED Flash, 20x digital zoom

Video recordingYes, CIF (max. clip length 2 h)
Multimedia MessagingYes
Video callsYes
Push to talkYes
Java supportYes, MIDP 2.0
Built-in memory22 MB
Memory card slotYes, RS-DV-MMC/MMC Mobile, hotswap, 2GB Maximum
BluetoothYes, 2.0 (A2DP Profile Not Supported)
InfraredNo
Data cable supportYes, Pop-Port, USB 2.0
BrowserWAP 2.0/xHTML, HTML
EmailYes
Music playerYes, stereo w/bass from headphones
RadioYes
Video PlayerYes
Polyphonic tonesYes, 64 voices
RingtonesYes - MIDI, AMR (NB-AMR), WAV, MP3, AAC
HF speakerphoneYes
Offline modeYes
BatteryBL-5C (850 mAh)
Talk timeUp to 3 hours 30 minutes
Standby timeUp to 265 hours
Weight126 grams
Dimensions616,78x103.64x300.5 millimeters
SAR-Rating0.5 W/kg
AvailabilityQ3/2005
ElseQuickoffice office suite, Opera Mobile web browser, Symantec Mobile Security 4.0 (6 months trial)
nokia n70 nokia n72 games software free download nokia n70 nokia n72 nokia n70 nokia n72 games software free download nokia n70 nokia n72 nokia n70 nokia n72 games software free download nokia n70 nokia n72 nokia n70 nokia n72 games software free download nokia n70 nokia n72 nokia n70 nokia n72 games software free download nokia n70 nokia n72 nokia n70 nokia n72 games software free download nokia n70 nokia n72

Saturday, February 13, 2010

Current state of tigers

India holds over half the world's tiger population. According to the latest tiger census report released on February 12, 2008 by the National Tiger Conservation Authority, the current tiger population stands at 1,411 (i.e. ranging between a minimum of 1,165 to a maximum of 1,657). The results include figures from 16 tiger states and are exclusive of Jharkhand and Sunderbans. The state of West Bengal was covered only partially (i.e. North Bengal) during the census.

The Tiger Census 2008 report has classified the tiger occupied forests in India into 6 landscape complexes; namely (a) Shivalik-Gangetic Plains, (b) Central Indian Landscape Complex (c) Eastern Ghats, (d) Western Ghats, (e) North-Eastern Hills and Bhramaputra Plains, and (f) Sunderbans.

Within the Shivalik-Gangetic plain landscape, it is reported that the tiger occupies 5080 km2 of forested habitats with an estimated population size of 297 (259 to 335) in six separate populations. In the Central Indian Landscape, tiger presence is currently reported from 47,122 km2 (11.6 % of forests) with an estimated tiger population of 451 (347 to 564) distributed in 17 populations.The Eastern Ghat landscape complex currently has about 15,000 km2 of potential tiger habitat. Tigers occupy 7,772 km2 of forested habitats with an estimated population size of 53 (49 to 57). Currently tigers occupy 21,435 km2 of forests within the Western Ghat Landscape comprising 21% of the forested area. The current potential tiger habitat in the landscape complex is about 51,000 km2. The population estimate for this landscape was 366 (297-434) tigers. North-Eastern hills and Bhramaputra plains currently reported tiger occupancy in 4230 km2 of forests. Many of the tiger populations, particularly those outside protected reserves, are fragmented, suffer from intense poaching pressure, a dwindling prey base and over-used habitat.

The strategy for tiger conservation in India revolves around the National Tiger Conservation Authority and the Wildlife (Protection) Act, 1972. Between the mid 1970's and mid-1980's, many protected areas (66 national parks and 421 wildlife sanctuaries) were set aside, including large tracts of tiger habitat. They were later increased to 96 national parks, 510 wildlife sanctuaries and 3 conservation reserves and 2 community reserves. This resulted in an increase in tiger densities at many locations. Tragically, these conservation successes were short lived. Rampant poaching for the trade in tiger parts - all destined for markets outside India's borders - now threatens the tiger's very existence.

Prevailing conservation efforts are not geared towards, nor have they adequately addressed, the new threats with new protection strategies ie. better law enforcement, training and support. Excellent new tiger protection measures (such as the recommendations of the (Subramanian Committee for the Prevention of Illegal Trade in Wildlife, 1994 and Tiger Task Force, 2005) have been proposed but not implemented and little effective action has been taken in the field. Few of the tiger reserves have an established intelligence network and nearly 80% of our tiger reserves do not have an armed strike force or basic infrastructure and equipment to combat poaching. The forest guards are often out-gunned and out-manned by poachers. In December 1998, three forest staff were murdered in Manas Tiger Reserve and several cases of murder and serious assault on forest guards have been reported since.

The last meeting of the National Board of Wildlife was held on 01 November 2007. Large development projects, such as mining and hydroelectric dams, are also taking their toll on the tiger's habitat. In the past ten years, thousands of square kilometers of forest land have been diverted and destroyed to facilitate such projects. Though mostly outside the protected network, the loss of this vital habitat will have serious repercussions on tiger conservation in India.

Since 1994, WPSI has made a concerted effort to gather accurate information on tiger poaching occurring throughout India. A total of 832 tigers are known to have been killed from 1994 to 2007. WPSIs extensive database of tigers poached has detailed information on poaching figures collected by us. These figures, however, are reported cases and represent only a fraction of the actual poaching activity in India.

Recent undercover investigations by the Wildlife Protection Society of India (WPSI) and the Environmental Investigation Agency (EIA) revealed that the trade in tiger and leopard body parts in China continues to thrive, operating without any hindrance from the Chinese government whilst driving India’s wild tigers closer towards extinction. (For more information, please refer to  Status of Tiger and Leopard   ,  Skinning The Cat (5mb) download video (5mb) requires Real Player)

Despite all these problems, India still holds the best chance for saving the tiger in the wild. Tigers occur in 17 States within the Republic of India, with 5 States reportedly having populations in excess of 100 tigers. There are still areas with relatively large tiger populations and extensive tracts of protected habitat. Adequate funding and international pressure will help. But probably the most effective way to implement tiger conservation action in India today is to enhance NGO participation. There are a number of dedicated organisations that are effectively involved in hands-on tiger conservation. They keep the issue energized on a national level and tenaciously try to increase political will to secure the tiger's future. The Indian conservation and scientific community is now a proven force. It needs to be strengthened.

Java Programms for USers ::::page 5

String Utility
/*
 * NumberUtility.java
 *
 *  Source:  http://www.freejavaguide.com  
 */

import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.Locale;

/**
 * Class provides common functions on number formats.
 */

public class NumberUtility {
 
    /**
     * Method takes Object as parameter and returns decimal number.
     * if argument is float or double and contains tailing zeros
     * it removes them. If argument is float or double then no change in return type.
     * Change the Format of the Number by changing the String Pattern
     */
    public static String changeToDecimalFormat(Object number) {

        BigDecimal bdNumber = new BigDecimal(number.toString());
        bdNumber = bdNumber.stripTrailingZeros();           //Returns a BigDecimal with any trailing zero's removed
        String pattern = "###,##0.0###########";  //To apply formatting when the number of digits in input equals the pattern
        DecimalFormat newFormat = new DecimalFormat(pattern, new DecimalFormatSymbols(Locale.US));
        return newFormat.format(bdNumber);

    }

    /* Method takes Object as parameter and removes commas from the parameter */
    public static double removeCommasFromNumber(Object number) {
        try {
            StringBuffer inputNo = new StringBuffer(number.toString());
            if (inputNo.length() > 0) {
                while (inputNo.indexOf(",") != -1) {
                    inputNo.deleteCharAt(inputNo.indexOf(","));
                }
            } else {
                return 0.0;
            }
            return Double.parseDouble(inputNo.toString());

        } catch (NumberFormatException e) {
            return 0.0;
        }
    }

    /* Some times its required to have a fixed set of decimal places for a 
     * number. We can set that by changing the precision number for a particular
     * input BigDecimal Input String
     */
    public static String changeToRequiredDecimals(String bigDecimalString,
            int precision) {
        String newFormattedString = null;
        String afterDecimal = null;
        if (bigDecimalString == null || bigDecimalString.length() == 0) {
            return "0.0";
        }
        if (bigDecimalString.contains(".")) {
            afterDecimal = bigDecimalString.substring(bigDecimalString
                    .indexOf(".") + 1);
            int length = Math.abs((afterDecimal.length() - precision));
            if (afterDecimal.length() < precision) {
                newFormattedString = bigDecimalString;
                for (int i = 0; i < length; i++) {
                    newFormattedString = newFormattedString + "0";
                }
            } else if (afterDecimal.length() > precision) {
                newFormattedString = bigDecimalString.substring(0,
                        bigDecimalString.length() - length);
                if (precision == 0) {
                    newFormattedString = newFormattedString.substring(0,
                            newFormattedString.indexOf("."));
             } else {
                 newFormattedString = bigDecimalString;
             }

         } else {
              if (precision > 0)
                  newFormattedString = bigDecimalString + ".";
              else
                  newFormattedString = bigDecimalString;
              for (int i = 0; i < precision; i++) {
                  newFormattedString = newFormattedString + "0";
              }
         }
        }
        return newFormattedString;
    }

    public static void main(String args[]){
     int intVar = 10;
     double doubleVar = 10.504000;
     float floatVar = 343534534348.5687654F;
     String commaString = "343,534,535,000.0";
     BigDecimal bdNumber = new BigDecimal("1234.8765");
     
     
     System.out.println(NumberUtility.changeToDecimalFormat(new Integer(intVar)));
     System.out.println(NumberUtility.changeToDecimalFormat(new Double(doubleVar)));
     System.out.println(NumberUtility.changeToDecimalFormat(new Float(floatVar)));
     
     System.out.println(NumberUtility.removeCommasFromNumber(commaString));
     
     System.out.println(NumberUtility.changeToRequiredDecimals(bdNumber.toString(), 8));
 
    }
}

Java Programms for USers ::::page 4

Date and Time

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class DateUtility {
 
/* Add Day/Month/Year to a Date
add() is used to add  values to a Calendar object. 
You specify which Calendar field is to be affected by the operation 
(Calendar.YEAR, Calendar.MONTH, Calendar.DATE). 
*/
 public static void addToDate(){
  System.out.println("In the ADD Operation");
 // String DATE_FORMAT = "yyyy-MM-dd";
  String DATE_FORMAT = "dd-MM-yyyy";  //Refer Java DOCS for formats
  java.text.SimpleDateFormat sdf =  new java.text.SimpleDateFormat(DATE_FORMAT);
  Calendar c1 = Calendar.getInstance();
  Date d1 = new Date();
  System.out.println("Todays date in Calendar Format : "+c1);
  System.out.println("c1.getTime() : "+c1.getTime());
  System.out.println("c1.get(Calendar.YEAR): " + c1.get(Calendar.YEAR));
  System.out.println("Todays date in Date Format : "+d1);
  c1.set(1999,0 ,20);   //(year,month,date)
  System.out.println("c1.set(1999,0 ,20) : "+c1.getTime());
  c1.add(Calendar.DATE,40);
  System.out.println("Date + 20 days is : " + sdf.format(c1.getTime()));
  System.out.println();
  System.out.println();
 }
 
 
/*Substract Day/Month/Year to a Date
 roll() is used to substract values to a Calendar object. 
 You specify which Calendar field is to be affected by the operation 
 (Calendar.YEAR, Calendar.MONTH, Calendar.DATE). 
 
 Note: To substract, simply use a negative argument. 
    roll() does the same thing except you specify if you want to roll up (add 1) 
    or roll down (substract 1) to the specified Calendar field. The operation only
    affects the specified field while add() adjusts other Calendar fields. 
    See the following example, roll() makes january rolls to december in the same 
    year while add() substract the YEAR field for the correct result

*/
 
 public static void subToDate(){
  System.out.println("In the SUB Operation");
  String DATE_FORMAT = "dd-MM-yyyy";
  java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(DATE_FORMAT);
  Calendar c1 = Calendar.getInstance(); 
  c1.set(1999, 0 , 20); 
  System.out.println("Date is : " + sdf.format(c1.getTime()));
  
  // roll down, substract 1 month
  c1.roll(Calendar.MONTH, false); 
  System.out.println("Date roll down 1 month : " + sdf.format(c1.getTime())); 

  c1.set(1999, 0 , 20); 
  System.out.println("Date is : " + sdf.format(c1.getTime()));
  c1.add(Calendar.MONTH, -1); 
  // substract 1 month
  System.out.println("Date minus 1 month : " + sdf.format(c1.getTime())); 
  System.out.println();
  System.out.println();
 }
 
 public static void daysBetween2Dates(){
  Calendar c1 = Calendar.getInstance();  //new GregorianCalendar();
  Calendar c2 = Calendar.getInstance();  //new GregorianCalendar();
     c1.set(1999, 0 , 20); 
     c2.set(1999, 0 , 22); 
     System.out.println("Days Between "+c1.getTime()+"\t"+ c2.getTime()+" is");
     System.out.println((c2.getTime().getTime() - c1.getTime().getTime())/(24*3600*1000));
     System.out.println();
  System.out.println();
 }
 
 public static void daysInMonth() {
  Calendar c1 = Calendar.getInstance();  //new GregorianCalendar();
     c1.set(1999, 6 , 20); 
     int year = c1.get(Calendar.YEAR);
     int month = c1.get(Calendar.MONTH);
//     int days = c1.get(Calendar.DATE);
  int [] daysInMonths = {31,28,31,30,31,30,31,31,30,31,30,31};
  daysInMonths[1] += DateUtility.isLeapYear(year) ? 1 : 0;
  System.out.println("Days in "+month+"th month for year "+year+" is "+ daysInMonths[c1.get(Calendar.MONTH)]);
     System.out.println();
  System.out.println();
 }
 
 public static void getDayofTheDate() {
  Date d1 = new Date();
  String day = null;
     DateFormat f = new SimpleDateFormat("EEEE");
     try {
      day = f.format(d1);
     }
     catch(Exception e) {
       e.printStackTrace();
     }
     System.out.println("The dat for "+d1+" is "+day);
     System.out.println();
  System.out.println();
 }
 
 public static void validateAGivenDate() {
  String dt = "20011223";   
  String invalidDt = "20031315";
  String dateformat = "yyyyMMdd";   
  Date dt1=null , dt2=null;
  try {     
   SimpleDateFormat sdf = new SimpleDateFormat(dateformat);    
   sdf.setLenient(false);    
   dt1 = sdf.parse(dt);  
   dt2 = sdf.parse(invalidDt);   
   System.out.println("Date is ok = " + dt1 + "(" + dt + ")");     
  }  
  catch (ParseException e) {     
   System.out.println(e.getMessage()); 
  }  
  catch (IllegalArgumentException e) {    
   System.out.println("Invalid date");     
  }
     System.out.println();
  System.out.println();
 }
 
 public static void compare2Dates(){
  SimpleDateFormat fm = new SimpleDateFormat("dd-MM-yyyy");
  Calendar c1 = Calendar.getInstance();
  Calendar c2 = Calendar.getInstance();
  
  c1.set(2000, 02, 15);
  c2.set(2001, 02, 15);
  
  System.out.print(fm.format(c1.getTime())+" is ");
  if(c1.before(c2)){
   System.out.println("less than "+c2.getTime());
  }else if(c1.after(c2)){
   System.out.println("greater than "+c2.getTime());
  }else if(c1.equals(c2)){
   System.out.println("is equal to "+fm.format(c2.getTime()));
  }
  System.out.println();
  System.out.println();
 }

 public static boolean isLeapYear(int year){
   if((year%100 != 0) || (year%400 == 0)){
    return true;
   }
   return false;
 }

 public static void main(String args[]){
  addToDate();
  subToDate();
  daysBetween2Dates(); //The "right" way would be to compute the julian day number of both dates and then do the substraction.  daysInMonth();
  validateAGivenDate();
  compare2Dates();
  getDayofTheDate();
 }
 
}

Java Programms for USers ::::page 3

Program 20
/* switch case demo
   Example :
           Input - 124
           Output - One Two Four */

class SwitchCaseDemo{
      public static void main(String args[]){
          try{
          int num = Integer.parseInt(args[0]);
          int n = num; //used at last time check
          int reverse=0,remainder;
          while(num > 0){
                remainder = num % 10;
                reverse = reverse * 10 + remainder;
                num = num / 10;
           }
          String result=""; //contains the actual output
          while(reverse > 0){
               remainder = reverse % 10;
               reverse = reverse / 10;
               switch(remainder){
                    case 0 :
                             result = result + "Zero ";
                             break;
                    case 1 :
                             result = result + "One ";
                             break;
                    case 2 :
                             result = result + "Two ";
                             break;
                    case 3 :
                             result = result + "Three ";
                             break;
                    case 4 :
                             result = result + "Four ";
                             break;
                    case 5 :
                             result = result + "Five ";
                             break;
                    case 6 :
                             result = result + "Six ";
                             break;
                    case 7 :
                             result = result + "Seven ";
                             break;
                    case 8 :
                             result = result + "Eight ";
                             break;
                    case 9 :
                             result = result + "Nine ";
                             break;
                    default:
                             result="";
                 }
            }
                System.out.println(result);
        }catch(Exception e){
             System.out.println("Invalid Number Format");
         }
     }
}

Program 21
/* Write a program to generate Harmonic Series.
   Example :
           Input - 5
           Output - 1 + 1/2 + 1/3 + 1/4 + 1/5 = 2.28 (Approximately) */
class HarmonicSeries{
      public static void main(String args[]){
      int num = Integer.parseInt(args[0]);
      double result = 0.0;
      while(num > 0){
            result = result + (double) 1 / num;
            num--;
      }
      System.out.println("Output of Harmonic Series is "+result);
  }
}

Program 22
/*Write a program to find average of consecutive N Odd no. and Even no. */
class EvenOdd_Avg{
      public static void main(String args[]){
      int n = Integer.parseInt(args[0]);
      int cntEven=0,cntOdd=0,sumEven=0,sumOdd=0;
      while(n > 0){
           if(n%2==0){
               cntEven++;
               sumEven = sumEven + n;
           }
           else{
               cntOdd++;
               sumOdd = sumOdd + n;
           }
           n--;
      }
      int evenAvg,oddAvg;
      evenAvg = sumEven/cntEven;
      oddAvg = sumOdd/cntOdd;
      System.out.println("Average of first N Even no is "+evenAvg);
      System.out.println("Average of first N Odd no is "+oddAvg);

  }
}

Program 23
/* Display Triangle as follow : BREAK DEMO.
    1
    2 3
    4 5 6
    7 8 9 10 ... N */
class Output1{
      public static void main(String args[]){
          int c=0;
          int n = Integer.parseInt(args[0]);
         loop1: for(int i=1;i<=n;i++){
         loop2: for(int j=1;j<=i;j++){
                       if(c!=n){
                            c++;
                            System.out.print(c+" ");
                       }
                       else
                           break loop1;
                    }
                    System.out.print("\n");
                 }
     }
}

Program 24
/* Display Triangle as follow
    0
    1 0
    1 0 1
    0 1 0 1 */
class Output2{
      public static void main(String args[]){
           for(int i=1;i<=4;i++){
              for(int j=1;j<=i;j++){
                            System.out.print(((i+j)%2)+" ");
                    }
                    System.out.print("\n");
                 }
     }
}      

Program 25
/* Display Triangle as follow
    1
    2 4
    3 6 9
    4 8 12 16 ... N (indicates no. of Rows) */
class Output3{
      public static void main(String args[]){
          int n = Integer.parseInt(args[0]);
                   for(int i=1;i<=n;i++){
                     for(int j=1;j<=i;j++){
                        System.out.print((i*j)+" ");
                    }
                    System.out.print("\n");
                 }
     }

}

Java Programms for USers ::::page 2

Program 11

/* Write a program to Concatenate  string using for Loop

   Example:
          Input - 5
          Output - 1 2 3 4 5 */
class Join{
      public static void main(String args[]){
      int num = Integer.parseInt(args[0]);
      String result = " ";
      for(int i=1;i<=num;i++){
           result = result + i + " ";
      }
      System.out.println(result);
  }
}

Program 12
/* Program to Display Multiplication Table */
class MultiplicationTable{
      public static void main(String args[]){
      int num = Integer.parseInt(args[0]);
      System.out.println("*****MULTIPLICATION TABLE*****");
      for(int i=1;i<=num;i++){
         for(int j=1;j<=num;j++){
            System.out.print(" "+i*j+" ");
         }
         System.out.print("\n");
      }
  }
}

Program 13
/* Write a program to Swap the values */
class Swap{
      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);
      }
}

Program 14
/* Write a program to convert given no. of days into months and days.
  (Assume that each month is of 30 days)
  Example :
           Input - 69
           Output - 69 days = 2 Month and 9 days */
class DayMonthDemo{
      public static void main(String args[]){
      int num = Integer.parseInt(args[0]);
      int days = num%30;
      int month = num/30;
      System.out.println(num+" days = "+month+" Month and "+days+" days");
   }
}

Program 15
/*Write a program to generate a Triangle.
  eg:
  1
  2 2
  3 3 3
  4 4 4 4 and so on as per user given number */
class Triangle{
      public static void main(String args[]){
          int num = Integer.parseInt(args[0]);
          for(int i=1;i<=num;i++){
             for(int j=1;j<=i;j++){
                System.out.print(" "+i+" ");
             }
             System.out.print("\n");
           }
    }
}

Program 16
/* Write a program to Display Invert Triangle.
   Example:
          Input - 5
          Output :
          5 5 5 5 5
          4 4 4 4
          3 3 3
          2 2
          1
*/
class InvertTriangle{
      public static void main(String args[]){
           int num = Integer.parseInt(args[0]);
           while(num > 0){
              for(int j=1;j<=num;j++){
                  System.out.print(" "+num+" ");
                }
                System.out.print("\n");
                num--;
            }
      }
}

Program 17
/*Write a program to find whether given no. is Armstrong or not.
  Example :
           Input - 153
           Output - 1^3 + 5^3 + 3^3 = 153, so it is Armstrong no. */
class Armstrong{
      public static void main(String args[]){
      int num = Integer.parseInt(args[0]);
      int n = num; //use to check at last time
      int check=0,remainder;
      while(num > 0){
           remainder = num % 10;
           check = check + (int)Math.pow(remainder,3);
           num = num / 10;
      }
      if(check == n)
            System.out.println(n+" is an Armstrong Number");
      else
            System.out.println(n+" is not a Armstrong Number");
   }
}

Program 18
/* Write a program to Find whether number is Prime or Not. */
class PrimeNo{
      public static void main(String args[]){
          int num = Integer.parseInt(args[0]);
         int flag=0;
         for(int i=2;i
             if(num%i==0)
              {
                 System.out.println(num+" is not a Prime Number");
                 flag = 1;
                 break;
              }
         }
         if(flag==0)
             System.out.println(num+" is a Prime Number");
    }
}

Program 19
/* Write a program to find whether no. is palindrome or not.
   Example :
           Input - 12521 is a palindrome no.
           Input - 12345 is not a palindrome no. */
class Palindrome{
      public static void main(String args[]){
          int num = Integer.parseInt(args[0]);
          int n = num; //used at last time check
          int reverse=0,remainder;
          while(num > 0){
                remainder = num % 10;
                reverse = reverse * 10 + remainder;
                num = num / 10;
           }
          if(reverse == n)
              System.out.println(n+" is a Palindrome Number");
          else
              System.out.println(n+" is not a Palindrome Number");
     }
}

Java Programms for USers ::::page 1

Program 1
//Find Maximum of 2 nos.
class Maxof2{
  public static void main(String args[]){
      //taking value as command line argument.
      //Converting String format to Integer value
      int i = Integer.parseInt(args[0]);
      int j = Integer.parseInt(args[1]);
      if(i > j)
          System.out.println(i+" is greater than "+j);
      else
          System.out.println(j+" is greater than "+i);
  }
}

Program 2
//Find Minimum of 2 nos. using conditional operator
class Minof2{
      public static void main(String args[]){
      //taking value as command line argument.
      //Converting String format to Integer value
      int i = Integer.parseInt(args[0]);
      int j = Integer.parseInt(args[1]);
      int result = (i
      System.out.println(result+" is a minimum value");
  }
}

Program 3
/* Write a program that will read a float type value from the   keyboard and print the following output.
   ->Small Integer not less than the number.
   ->Given Number.
   ->Largest Integer not greater than the number.
*/
class ValueFormat{
  public static void main(String args[]){
      double i = 34.32; //given number 
      System.out.println("Small Integer not greater than the number : "+Math.ceil(i));
      System.out.println("Given Number : "+i);
      System.out.println("Largest Integer not greater than the number : "+Math.floor(i));
  }

Program 4
/*Write a program to generate 5 Random nos. between 1 to 100, and it
  should not follow with decimal point.
*/
class RandomDemo{
      public static void main(String args[]){
          for(int i=1;i<=5;i++){
              System.out.println((int)(Math.random()*100));
          }
    }
}

Program 5
/* Write a program to display a greet message according to
   Marks obtained by student.
*/
class SwitchDemo{
      public static void main(String args[]){
          int marks = Integer.parseInt(args[0]);                //take marks as command line argument.
         switch(marks/10){
            case 10:
            case 9:
            case 8:
                     System.out.println("Excellent");
                     break;
            case 7:
                     System.out.println("Very Good");
                     break;
            case 6:
                     System.out.println("Good");
                     break;
            case 5:
                     System.out.println("Work Hard");
                     break;
            case 4:
                     System.out.println("Poor");
                     break;
            case 3:
            case 2:
            case 1:
            case 0:
                     System.out.println("Very Poor");
                     break;
            default:
                     System.out.println("Invalid value Entered");
      }
 }
}

Program 6
/*Write a program to find SUM AND PRODUCT of a given Digit. */
class Sum_Product_ofDigit{
      public static void main(String args[]){
            int num = Integer.parseInt(args[0]);         //taking value as command line argument.
            int temp = num,result=0;
            //Logic for sum of digit
            while(temp>0){
               result = result + temp;
               temp--;
            }
            System.out.println("Sum of Digit for "+num+" is : "+result);
            //Logic for product of digit
            temp = num;
            result = 1;
            while(temp > 0){
                 result = result * temp;
                 temp--;
            }
            System.out.println("Product of Digit for "+num+" is : "+result);
   }
}

Program 7
/*Write a program to Find Factorial of Given no. */
class Factorial{
      public static void main(String args[]){
          int num = Integer.parseInt(args[0]);                 //take argument as command line
          int result = 1;
          while(num>0){
                result = result * num;
                num--;
          }
          System.out.println("Factorial of Given no. is : "+result);
   }
}

Program 8
/*Write a program to Reverse a given no. */
class Reverse{
      public static void main(String args[]){
          int num = Integer.parseInt(args[0]);               //take argument as command line
          int remainder, result=0;
          while(num>0){
              remainder = num%10;
              result = result * 10 + remainder;
              num = num/10;
         }
         System.out.println("Reverse number is : "+result);
    }
}

Program 9
/*Write a program to find Fibonacci series of a given no.
  Example :
        Input - 8
        Output - 1 1 2 3 5 8 13 21
*/
class Fibonacci{
      public static void main(String args[]){
          int num = Integer.parseInt(args[0]);                        //taking no. as command line argument.
          System.out.println("*****Fibonacci Series*****");
          int f1, f2=0, f3=1;
          for(int i=1;i<=num;i++){
             System.out.print(" "+f3+" ");
             f1 = f2;
             f2 = f3;
             f3 = f1 + f2;
          }
   }
}

Program 10
/* Write a program to find sum of all integers greater than 100 and
   less than 200 that are divisible by 7 */
class SumOfDigit{
      public static void main(String args[]){
      int result=0;
      for(int i=100;i<=200;i++){
           if(i%7==0)
              result+=i;
      }
      System.out.println("Output of Program is : "+result);
   }
}
Powered By Blogger