how to declare a function in c++
// function example
#include <iostream>
using namespace std;
int addition (int a, int b)
{
int r;
r=a+b;
return r;
}
how to declare a function in c++
// function example
#include <iostream>
using namespace std;
int addition (int a, int b)
{
int r;
r=a+b;
return r;
}
functions questions c++
#include<iostream>
using namespace std;
int fib(int x)
{
if(x == 0)
{
return 0;
}
else if(x==1)
{
return 1;
}
else
{
return fib(x-1)+fib(x-2);
}
}
int main()
{
cout << fib(0) << "n";
cout << fib(1) << "n";
cout << fib(2) << "n";
cout << fib(3) << "n";
cout << fib(4) << "n";
cout << fib(5) << "n";
return 0;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us