SEO stands for Search Engine Optimization. SEO is the process or activity of optimizing website or web pages in order to make them available at higher position in search results of search engines. Some of worlds powerful search engines are Google, Yahoo, and Bing.
Sunday, 21 February 2016
Friday, 12 February 2016
Java Factorial Program using Recursion
class FactorialRecusionProgramExample{
static int facto(int a){
if (a == 0)
return 1;
else
return(a * facto(a-1));
}
public static void main(String args[]){
int i,f=1;
int num=5;//Number for which we are calculating factorial
f = facto(num);
System.out.println("Factorial of "+num+" is: "+f);
}
}
static int facto(int a){
if (a == 0)
return 1;
else
return(a * facto(a-1));
}
public static void main(String args[]){
int i,f=1;
int num=5;//Number for which we are calculating factorial
f = facto(num);
System.out.println("Factorial of "+num+" is: "+f);
}
}
Java Factorial Program
class FactorialExampleProg{
public static void main(String args[]){
int j,f=1;
int num=5;//Number for which we want to calculate factorial
for(j=1;j<=num;j++){
f=f*j;
}
System.out.println("Factorial of "+num+" is: "+f);
}
}
public static void main(String args[]){
int j,f=1;
int num=5;//Number for which we want to calculate factorial
for(j=1;j<=num;j++){
f=f*j;
}
System.out.println("Factorial of "+num+" is: "+f);
}
}
Thursday, 11 February 2016
Java program to check Prime number
class PrimenumExample{
public static void main(String args[]){
int j,m=0,f=0;
int n=7;//Number which we want to check
m=n/2;
for(j=2;j<=m;j++){
if(n%j==0){
System.out.println("Number is not prime");
f=1;
break;
}
}
if(f==0)
System.out.println("Number is prime");
}
}
public static void main(String args[]){
int j,m=0,f=0;
int n=7;//Number which we want to check
m=n/2;
for(j=2;j<=m;j++){
if(n%j==0){
System.out.println("Number is not prime");
f=1;
break;
}
}
if(f==0)
System.out.println("Number is prime");
}
}
Friday, 5 February 2016
Java Program to reverse a string
import java.util.*; class RevString { public static void main(String args[]) { String orig, rev = ""; Scanner in = new Scanner(System.in); System.out.println("Enter a string you want to reverse :"); orig = in.nextLine(); int length = orig.length(); for ( int i = length - 1 ; i >= 0 ; i-- ) rev = rev + orig.charAt(i); System.out.println("Reverse of string is: "+rev); } }
Subscribe to:
Posts (Atom)