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

Can we write a class without main method in java?

1003


How many functional interfaces does java 8 have?

1082


Is math an abstract class in java?

1079


Why super is first line in java?

1100


what do you mean by classloader in java?

1074


What is type conversion in java?

1095


Java Compiler is stored in JDK, JRE or JVM?

1570


How do you sort in descending order in java using collections sort?

970


What do you mean by inner class in java? Explain

1123


List the different types of classloaders in java.

1018


What is var keyword ?

1238


Explain about transient variables in java?

1150


Does collectionutils isempty check for null?

1482


Is java still relevant?

1027


What is the difference between the boolean & operator and the && operator in java programming?

1097