123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- import java.lang.*;
-
-
- public class NumberUtilities {
- //private static String str = "";
-
- public static String getRange(int stop) {
- String str = "";
- for(int i=0; i<stop; i++) {
- str += i;
- }
- return str;
- }
-
- public static String getRange(int start, int stop) {
- String str = "";
- for(int i=start;i<stop;i++)
- str += i;
- return str;
- }
-
-
- public static String getRange(int start, int stop, int step) {
- String str = "";
- for(int i=start;i<stop;i+=step)
- str += i;
- return str;
- }
-
- public static String getEvenNumbers(int start, int stop) {
- String str = "";
- for(int i=start;i<stop;i++){
- if( i%2==0)
- str += i;
- }
- return str;
- }
-
-
- public static String getOddNumbers(int start, int stop) {
- String str = "";
- for(int i=start;i<stop;i++){
- if(i%2!=0)
- str += i;
- }
- return str;
- }
-
-
- public static String getExponentiations(int start, int stop, int exponent) {
- String str = "";
- for(int i=start;i<=stop;i++)
- str += (int)Math.pow(i,exponent);
- return str;
- }
- }
|