A class is nothing but a blueprint or a template for creating different objects which defines its properties and behaviors. Java class objects exhibit the properties and behaviors defined by its class. A class can contain fields and methods to describe the behavior of an object.
class Fabonic
{
public static void main(String s[])
{
int a=0,fab=0,b=1,c,n=11,i;
System.out.println("how much element do u want of fabocci series :");
System.out.println("fabocci series : ");
System.out.println(a);
System.out.println(b);
for(i=0;i<=n;i++)
{
fab=a+b;
System.out.println(fab);
c=a;
a=b;
b=fab;
}
}
}
No comments:
Post a Comment