Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- /*
- Рекурзија :
- int minCifra(int broj,int min)
- {
- if(broj == 0) {
- return min;
- }
- if(min > broj%10) {
- min = broj%10;
- }
- minCifra(broj/10, min);
- }
- */
- int minCifra(int broj)
- {
- int min = 100000;
- while(broj > 0) {
- if(min > broj % 10) {
- min = broj%10;
- }
- broj = broj / 10;
- }
- return min;
- }
- int main () {
- int broj,min = 10000000;
- while(scanf("%d",&broj)) {
- printf("%d\n",minCifra(broj));
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment