Guest User

Untitled

a guest
Jan 15th, 2017
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #include<stdio.h>
  2. typedef int bool;
  3. #define true 1
  4. #define false 0
  5. /*
  6. 4!
  7. 1*2*3*4
  8. 1*1
  9. 1*2
  10. 2*3
  11. 6*4
  12.  
  13. */
  14. long long silnia (int n)
  15. {
  16. if(n < 2)
  17. {
  18. return 1;
  19. }
  20. return n*=silnia(n-1);
  21. }
  22.  
  23.  
  24.  
  25. int main ()
  26. {
  27. bool warunek = true;
  28. while (true)
  29. {
  30. int n;
  31. char znak;
  32. printf("Wprowadz liczbe dla ktorej chcesz obliczyc silnie: ");
  33. scanf("%d", &n);
  34. printf("\nWynik silni to: %d\n", silnia(n) );
  35. printf("Jesli chcesz kontynuowac nacisnij \"t\" \n");
  36. scanf("%c", &znak);
  37. printf("%c", znak);
  38. if (znak != 't') break;
  39.  
  40. }
  41. return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment