yesterday i was study calculus " An Increasing / decreasing seq " ..

in calculus we solve these problems as following :

given (an), and find if sequences is Inc or Dec.

we have to find an+1 first .

then divide an+1/an ..

if the result < 1 so it is decreasing , otherwise it is increasing.

i solved many problems with many cases .. factorial , exponential functions .. etc . I said to myself .. if i have program to make my life easier and give me the answer directly that will save my time .. and my effort :rolleyes: .

i thought about this program starting by solving simple problem for example:

an = n .

an+1 = n+1

an+1/an = n+1/n .... n+1 > n .. so that it is increasing .

if i could write this program .. then i believe i can write complex cases

such as factorial , ..etc.

Now ,

input is an .. which user give to the program .

of course ! input maybe n or n+1 , n+2 .. etc.

but what i have focus on is replace each n by( n+1 ) !

this what i did until now ! , because i started programming using java script , and am just little bit confused about java .. please tell me does until

now am on the line .. give me yours advice to improve myself ..

am stack little bit .. but i believe i can complete this program.

Code:

public static void main(String[] args) {

// TODO code application logic here

Scanner input = new Scanner(System.in);

System.out.println("Please Enter the an");

String an = input.nextLine();

System.out.println("your an is"+"["+an+"]");

int a = an.length();

System.out.println("the an length is"+"["+a+"]");

char []arr=an.toCharArray();

String aa = "n+1";

for(int index=0;index<arr.length;index++)

{

System.out.println("the CharArray is"+"["+arr[index]+"]");

}

for(int i =0;i<arr.length;i++)

if(an.charAt(i)=='n')

{

System.out.println("the new is"+"["+aa+"]");

}

else

{

System.out.println("the new is"+"FAILED ");

}

}