Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication1.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include<iostream>
- using namespace std;
- int Faktorijel(int n)
- {
- if (n == 1)
- return n;
- return n * Faktorijel(n - 1);
- }
- void Unos(int niz[], int indeks, int vel)
- {
- if (indeks == vel)
- return;
- cout << "Unesite element " << indeks + 1 << ": ";
- cin >> niz[indeks];
- Unos(niz, indeks + 1, vel);
- }
- void Ispis(int niz[], int indeks, int vel)
- {
- if (indeks == vel)
- {
- cout << endl;
- return;
- }
- cout << niz[indeks]<< " ";
- Ispis(niz, indeks + 1, vel);
- }
- void main()
- {
- cout << "Faktorijel: " << Faktorijel(4) <<endl;
- int niz[5];
- Unos(niz, 0, 5);
- Ispis(niz, 0, 5);
- system("Pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement