Advertisement
Vprento

производ цифри (рекурзија)

Nov 27th, 2017
336
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.25 KB | None | 0 0
  1. #include <stdio.h>
  2. double cifri(int n) {
  3.         if (n==0)
  4.                 return 1;
  5.         else {
  6.                 return n%10*cifri(n/10);
  7.         }
  8. }
  9. int main() {
  10. int x;
  11. float y;
  12. scanf("%d",&x);
  13. y=cifri(x)/(double)x;
  14. printf("%.2f", y);
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement