Created
April 2, 2016 10:04
-
-
Save rista404/bddf17cc1ccc1c5b99bba6b1501df788 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int s, n, vrNov[10], brNov[10]; | |
void Ispis() { | |
for(int i = 0; i < n; i++) | |
printf("%d novcanica od %d din ", brNov[i], vrNov[i]); | |
printf("\n"); | |
} | |
void Rasitni(int indNov, int suma){ | |
if(indNov >= n){ | |
if(suma == 0) Ispis(); | |
} | |
else { | |
for(int i = 0; i <= suma / vrNov[indNov]; i++){ | |
brNov[indNov] = i; | |
Rasitni(indNov + 1, suma - vrNov[indNov] * brNov[indNov]); | |
} | |
} | |
} | |
main() { | |
printf("Br. razlicitih novcanica: \t"); | |
scanf("%d", &n); | |
printf("Suma: \t"); | |
scanf("%d", &s); | |
for(int i = 0; i < n; i++) | |
scanf("%d", &vrNov[i]); | |
Rasitni(0, s); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment