SHARE
TWEET

proba

a guest Oct 23rd, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // POKAZIVACI
  2. #define _CRT_SECURE_NO_WARNINGS
  3. #include <stdio.h>
  4.  
  5. // tip_povratne_vrednosti ime_fje(parametri){ // TODO return nesto}
  6. int faktorijel(int broj) {
  7.     int f = 1;
  8.     //5,4,3,2
  9.     for (int i = broj; i > 1; i--)
  10.     {
  11.         f = f * i; // f*=i;
  12.     }
  13.     return f;
  14. }
  15. void procFaktorijel() {
  16.     int x, f = 1;
  17.     printf("Unesite x: ");
  18.     scanf("%d", &x);
  19.     for (int i = x; i > 1; i--)
  20.     {
  21.         f = f * i; // f*=i;
  22.     }
  23.     printf("%d! = %d\n", x, f);
  24. }
  25. int main(void) {
  26.     /*int a = 2;
  27.     printf("a = %d     &a = %p\n", a, &a);
  28.     int* pa = &a;
  29.     printf("pa = %p    *pa = %d     &p = %p\n", pa, *pa, &pa);
  30.     *pa = 21;
  31.     printf("a = %d", a);*/
  32.     int fakt5 = faktorijel(5);
  33.     //printf("5! = %d", fakt5);
  34.     procFaktorijel();
  35.  
  36. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top