27 Mart 2017 Pazartesi

QT FIBONACCI

#include "fibo.h"
#include
fibo::fibo()
{
   int range,first=0,second=1,tmp;

   std::cout << "Please Fibonacci Ranger : ";
   std::cin>>range;


   for(int c =0; c < range ; c++)
   {
       if(c<=1)
       {
           second = c;
       }
       else
       {
           tmp = second;
           second = first+second;
           first = tmp ;
       }
       std::cout<< second <<"  ,  \t  ";
   }




}
Share: