alternating Fibonacci and prime series The task is to print the following series 

1 2 1 3 2 5 3 7...


The elements at odd positions are Fibonacci series terms and the elements at even positions are prime numbers. Given an input 'n' the element at the nth position in the series has to be printed. 
eg. when n = 4, output will be 3. n = 7, output will be 3

I've tried to solve the problem by returning nth prime number or nth fibonacci term. I am looking for any improvements that can be  made to the code to optimize it further. 

#include &lt;bits/stdc++.h&gt;
using namespace std;


int retPrime(int n)
{
    //Using sieve of Eratosthenes to generate primes 
    int size = n + 1;
    bool Primes[100];
    int count = 0;
    memset(Primes, true, sizeof(Primes));
    for (int i = 2; i&lt;sqrt(100); ++i)
    {
        if (Primes[i] == true)
        {
            for (int j = i * 2; j &lt;= 100; j = j + i)
            {
                Primes[j] = false;
            }
        }
    }
    int primeIndex=0;
    int i = 2;
    while (count != n)
    {
        if (Primes[i] == true)
        {
            count++;
            primeIndex = i;
        }
        ++i;
    }
    return primeIndex;
}

int retFib(int n)
{
    if(n&lt;=1){
        return n;
    }
    return retFib(n-1)+retFib(n-2);
}
int main()
{
    int n;
    cin &gt;&gt; n;
    if(n%2==0)
        cout &lt;&lt; retPrime(n/2)&lt;&lt;" ";
    else
        cout &lt;&lt; retFib((n/2)+1)&lt;&lt;" ";
    return 0;
}
&lt;bits/stdc++.h&gt; is non-standard and likely far more than you actually need. Unless coupled with use of precompiled headers, it will slow down compilation at least. Replace it with the standard includes. See "How does #include &lt;bits/stdc++.h> work in C++?".
Never import wholesale any namespace which isn't designed for it. Doing so leads to conflicts, silent changes of behaviour, and generally brittle code. See "Why is “using namespace std” considered bad practice?".
Crank up the warning-level for your compiler. You will see it complain that size in retPrime() is unused.
There are only two good reason to give a variable a bigger scope than needed: Restricting the scope would be more verbose, or constructing it anew repeatedly would be more expensive. Otherwise, it's needless extra-stress put on each reader to understand things.
Avoid magic numbers. Instead, use some well-named constant, or simply eliminate them.
std::sqrt() may be required by the IEEE Standard to be exact. But does your implementation guarantee IEEE-conformance? Anyway, why not start with the square-roots?
Try to use fewer variables. Instead of incrementing a new variable up to a target, decrement the target if you don't need it any longer.
If you detect an error, like running beyond the bounds of your sieve, throw an exception, return an obviously impossible value (0 is a good candidate), or abort the program. But don't return a value which looks legitimate but is wrong.
Take a bit more care with formatting. An empty line before each function is a good idea, but please neither more (before the first) nor less (before the last).
retFib() and retPrime() are curious names. getFibonacci() and getPrime() seem better.
You really should add a function for your own series, abstracting the details away.
Comparing booleans against true or false is just pointless verbosity. Use the value directly, or after Negation with !.
There is no guarantee that a bool is a byte big. Nor that memsetting every byte to 1 will result in a valid bool, let alone that it's true. Use std::fill, or reverse the logic and use aggregate-initialization to start with all-false instead.

Even better, consider that the only even prime is 2, and change the code accordingly.
Calculating fibonacci naively needs \$O(n)\$ space and \$O(2^n)\$ time. Consider being slightly more clever and calculate it iteratively in \$O(1)\$ space and \$O(n)\$ time.
The conditional operator condition ? true_exp : false_exp is excellent for selecting one of two expressions. Use it where appropriate.
You should end each line of output with \n, it's expected. A single space instead is surprising.
If you want to stream a single character, use a character-literal, not a length-one string-literal. It might be slightly more efficient.
return 0; is implicit for main().
Use noexcept where appropriate.
Don't make things external for no reason. It increases the chance for collisions, and decreases the chance for inlining.
Input can fail. Deal with it.
As a final point, it might be better to just pre-compute the full sequence and be done with it. That might even save space.


Modified code:

#include &lt;iostream&gt;

static int getPrime(int n) noexcept {
    //Using sieve of Eratosthenes to generate primes
    constexpr auto sqrt_size = 10;
    constexpr auto size = sqrt_size * sqrt_size;
    if (!n) return 2;
    bool prime[size] = {false, false, true};
    for (int i = 3; i &lt; size; i += 2)
        prime[i] = true;
    for (int i = 3; i &lt; sqrt_size; i += 2) {
        if (!prime[i])
            continue;
        if (!--n)
            return i;
        for (int j = i + i; j &lt; size; j += i)
            prime[i] = false;
    }
    for (int i = (sqrt_size &amp; ~1) + 1; i &lt; size; i += 2)
        if (prime[i] &amp;&amp; !--n)
            return i;
    return 0;
}

static int getFibonacci(int n) noexcept {
    int last = 0, r = 1;
    while (n-- &gt; 0) {
        int temp = last + r;
        last = r;
        r = temp;
    }
    return r;
}

static int mySeries(int n) noexcept {
    return n % 2 ? getFibonacci(n / 2 + 1) : getPrime(n / 2);
}

int main() {
    int n;
    if (std::cin &gt;&gt; n)
        std::cout &lt;&lt; mySeries(n) &lt;&lt; '\n';
    else
        std::cerr &lt;&lt; "Could not understand your input. Expected a number.\n";
}