Wednesday, July 30, 2014

how to find out the sum of the fibonacci number ??

how to find out the sum of the fibonacci number ??

first of the simple thing here:

What is the fibonacci number ?

So it is the series start as below:

0 1 1 2 3 5 8 13 21.......

you can find out this one easily: (i run this programme in Dev c++ 4.2.1)

1) for the short number:

#include<stdio.h>
#include<conio.h>
int main()
{
    int x,y,sum,n,i;
    x=0,y=1;
    printf("how much number you want to print:");
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        sum=x+y;
        x=y;
        y=sum;
    }
    printf("\nthe sum of the fibonacci number is=%d",sum);
   
}

2)

the real logic is come now because what you can think for the large number.because the above programme can only count the sum around the 9 digit only.
you can check this one by the find the sum first 48 number.it will be negative means the answer can not store in the int. so we apply our logic here.



#include<stdio.h>
#include<conio.h>
int main()
{
    int i,k,j=1,temp,a[100]={'0'},b=0,c[100]={'0'},n;
    a[0]=1,c[0]=0;      //initialize the value of the two array
    printf("how many value you want of fibonacci number :");
    scanf("%d",&n);
    for(k=1;k<=n;k++)
    {
    for(i=0;i<=b;i++)
    {
              if(temp>0)       //case 1
         
            {
                j=a[i]+c[i]+temp;
                c[i]=a[i];
            a[i]=j%10;
            temp=j/10;
                //  printf("the value of i=%d a[%d]=%d c[%d]=%d b=%d\n",i,i,a[i],i,c[i],b);  //to understand the process
                }
            else            //case 2
            {
            j=a[i]+c[i]+temp;
            c[i]=a[i];
            a[i]=j%10;
            temp=j/10;
            //    printf("the value of i=%d a[%d]=%d c[%d]=%d b=%d\n",i,i,a[i],i,c[i],b);     //to understand the process
            }
        if(temp>0 && i==b)   //case 3
                {
                a[i+1]=temp;
                temp=0;
                b++;
                i++;
                //    printf("the value of i=%d a[%d]=%d c[%d]=%d b=%d\n\n",i,i,a[i],i,c[i],b);   // to understand the process
                }
       
    }
}
    for(k=b;k>=0;k--)
    {
        printf("%d",a[k]);
    }
}




it will work for any number of digit value. Just increase the value of the two array when needed to store more digit.but logic of array use here is awasome guys..




Wednesday, February 5, 2014

How to Shutdown,Hibernate,Log off or Restart your laptop ?

      Hai guys resently i listened something  from my  friends which one inspire me to create something for them. Actually it happened with some others of us also. But we are may be not focus on that type of the problem and also their solutions.

       My friends problem is that whenever he is watching a movie or something at the time he is sleeping.That's why his laptop keep starts. And it is hibernated after when the battery will be die .


       Form this incident i just think if we develope the simple softwere which can be solve the simple problem. Then this softwere is implemented by me. which i give the name onsleeper.exe  


      you can easily use for your laptop or pc:-


Step 1:-


 download the onsleeper.exe   then click on the " create download link " on that page..


Step 2:-


now you can run the softwere and then you got the starting screen like below:



Step 3:-
now you have to give the time in seconds. After this time your pc or laptop will be...what ever you choice..

form these all thing you give your choise.
Ex; if you print 2 then you laptop will be shutdown after the given time...


try it ....it is too much easy and i wish it will help you a lot...

thanks !!!!! 

                                                                                                                  Amul@Butter