Search
 
SCRIPT & CODE EXAMPLE
 

CPP

tribonacci series c++

 int n;
    cin>>n;
    int a=0,b=0,c=1;
    if (n < 3) return 0;
    cout<<a<<" "<<b<<" "<<c<<" ";
    for(int i = 1; i<= n-3; i++){
        int d = a + b + c;
        cout<<d<<" ";
        a = b;
        b = c;
        c = d;
    }
Comment

PREVIOUS NEXT
Code Example
Cpp :: celsius to kelvin formula 
Cpp :: iterator on std::tuple 
Cpp :: include all libraries in c++ 
Cpp :: get current directory cpp 
Cpp :: c++ print colorful 
Cpp :: remove element by index from vector c++ 
Cpp :: clear buffer memory in c / c++ 
Cpp :: unordered_map of pair and int 
Cpp :: c++ string erase all occurrences 
Cpp :: remove all element of vector c++ 
Cpp :: check compiler version c++ 
Cpp :: how to make string get spaces c++ 
Cpp :: angle to vector2 
Cpp :: constant pointer c++ 
Cpp :: strcat without using built in function 
Cpp :: can you chnage the address of a pointer 
Cpp :: initialize a pair 
Cpp :: cuda __constant__ 
Cpp :: qt qimage load from file 
Cpp :: c++ enum rand 
Cpp :: how to remove spaces from a string 
Cpp :: number to binary string c++ 
Cpp :: c++ parse int 
Cpp :: resize two dimensional vector c++ 
Cpp :: how to initialize 2d vector in c++ 
Cpp :: convert string into integer in c++ 
Cpp :: lcm function c++ 
Cpp :: taking a vector in c++ containing element 
Cpp :: c++ extend class 
Cpp :: C++ switch - case - break 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =