Fresh Information, Great Ideas, Latest Product Review & Specification » Computer & Gadget

Fresh Information, Great Ideas, Latest Product Review & Specification » Home and Appliances

Fresh Information, Great Ideas, Latest Product Review & Specification » Camera & Photography

Friday, July 9, 2010

java loop

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.*;
public class activity
{
public static void main( String[] args ) throws IOException {
BufferedReader dataIn = new BufferedReader(new
InputStreamReader( System.in) );
int fnum;
int lnum;

System.out.println("Enter first number:");
System.out.flush();
fnum = Integer.parseInt( dataIn.readLine());


if (fnum != fnum){
}

System.out.print ("Enter last number : ");
System.out.flush();
lnum = Integer.parseInt( dataIn.readLine());

if (fnum > lnum){
System.out.print("Cannot allow to make a loop!");
System.exit(1);
}



if (fnum == fnum){
while (fnum <= lnum){
System.out.println(fnum);
fnum++;
}
}

else{
System.out.print("Cannot allow to make a loop");
}





}
}

1 comment: