Posts

Showing posts with the label java

Exponentiation algorithm

Image
In programming there are not just 1 method to solve the problems for the exponential algorithm.What is exponential algorithm? Well is also can be mention as power. For example 2 to the power of 3 is 8 (2^3=8). Exponential algorithm is to find the value through computational way. You can computed an exponential by iterative. For example (in python): def iterPower(base, exp):     result=base     if exp==0:         return 1     else:         while exp>1:             result*=base             exp-=1         return result The code is like keep multiple the base number while minus the exponential value until the exp is 0.Is like 5^5=5*5*5*5*5 Above is an exponential by iteratively executing successive multiplications. Exponential can be computed in a recursive function. def recurPower(base, exp):     if exp==0: ...

Unique Number in java

The below is one of the example of unique number code which mean that the number of input must be unique than the input number before.Below is one of the example source code! Copy to IDE for better view! public static void unique(int[] list,int key){ Scanner scanner=new Scanner(System.in); int k=0;   //the number of value k use to indicate the time of repeated number //Search the number in the array list whether got repeated for(int i=0;i<list.length;++i){ //if there are 1 similar the return values "k" plus 1 if (key==list[i]){k++;} //if the k is more or equal to two mean got repeated input one time if(k>=2){ System.out.println("The number "+list[i]+" is repeated"); System.out.println("The number that is already key in are "); //print out the values that is already key in for (int j=0;j<i;j++){ System.out.print(list[j]+" ...

what is the difference between while and do while

A while loop can be used to execute a body of statement when the condition is correct! The syntax is like : while(condition){ //statements body } Example: int j=0,i=3; while(j<i){ System.out.println(j); j++; } Output : 0 1 2 The do...while loop almost same with the while loop except it will execute the statement before the checking the condition !Here you go the syntax : do{ //statement } Example: /*The j is not smaller that i but it will print the value of j.It won't print any thing if you put this condition on the while loop*/ int j=0,i=0; do{ System.out.println(j); }while(j<i);  Output : 0

Step to become a great web developer

Image
There are many computer language you need to know to become a web developer on the web. The first language you should learn is  H yper  T ext  M arkup  L anguage ( HTML) Here is the HTML resources: W3school HTML Html dog The second thing you need to learn is Cascading Style Sheet (CSS) If HTML is tell what is your structure of your house and the size of your house then CSS is like wallpaper for your room,what tree you have plant and others! The W3school also provide a good learning tutorial for you !You can go and check the CSS . Here is a good tool you can use it for your website. Anothers programming language you need to learn is JavaScript! JavaScript is a web browser scripting language, all the action will execute within the web Browser. Recently Google has lunching a new language call Dart !It was the programming language for the JavaScript ! With the Dart platform, you can write code that runs on server...