Skip to content

Instantly share code, notes, and snippets.

@saninb
Created January 23, 2014 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saninb/8583581 to your computer and use it in GitHub Desktop.
Save saninb/8583581 to your computer and use it in GitHub Desktop.
c++ rekurzija
#include <iostream>
using namespace std;
void rekurzija(int argument);
void main()
{
int broj = 0;
do
{
cout << "Unesite broj od 1 do 10 !" << endl;
cin >> broj;
} while (broj<1 || broj>10);
rekurzija(broj);
system("pause");
}
void rekurzija(int argument)
{
if (argument>0)
{
cout << "Trenutna vrijednost argumenta je: " << argument << endl;
argument--;
rekurzija(argument);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment