Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

how to print a numbers from 1 to 100 with out using control
structures?

Answer Posted / sushila

public class Arr
{
static int a[]=new int[100];
static int i=0;
public static void main(String args[])
{
try
{
i=add(i);
a[i]=i;
main(args);
}
catch(ArrayIndexOutOfBoundsException e){

}
}
static int add(int i)
{
System.out.println(++i);
return ++i;
}
}

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does || || mean in math?

951


What is the difference between the font and fontmetrics classes in java programming?

1172


How would you use Bubble Sort to sort the number of elements?

1017


What is the transient keyword?

2209


Define interface in java?

1094


Why we used break and continue statement in java?

1163


Can you instantiate the math class in Java?

1103


Is null an object in java?

1040


What is adapter in java?

935


What is the difference between ArrayList and Vector? which one is better in Java

1156


Can you inherit from an abstract class java?

1002


What is the difference between heap memory and stack memory?

1083


Does set allows null in java?

975


Difference between arraylist and hashset in java?

1154


Difference between concurrent hashmap and hashtable and collections

1075