#include <iostream>
#include <cmath>
int rec(const int var1)
{
if(var1 > 0)
if(var1 == 1)
return 10;
return rec(var1-1) + pow(-1, var1);
}
int main()
int
N;
std::cin >> N;
std::cout << rec(N) << std::endl;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <iostream>
#include <cmath>
int rec(const int var1)
{
if(var1 > 0)
{
if(var1 == 1)
return 10;
return rec(var1-1) + pow(-1, var1);
}
}
int main()
{
int
N;
std::cin >> N;
std::cout << rec(N) << std::endl;
}