Advertisement
ebx

NZD

ebx
May 4th, 2011
593
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.46 KB | None | 0 0
  1. #include <stdio.h>
  2. int main(int argc, char **argv) {
  3.     int broj, nzd, br=1, i, n;
  4.     printf("n = ");
  5.     scanf("%d", &n);
  6.     printf("1. broj = ");
  7.     scanf("%d", &broj);
  8.     nzd=broj;
  9.     while (n>1) {
  10.         br++;
  11.         printf("%d. broj = ", br);
  12.         scanf("%d", &broj);
  13.         for (i=nzd; i>=1; i--)
  14.             if ((broj%i==0)&&(nzd%i==0)) {
  15.                 nzd=i;
  16.                 break;
  17.                 }
  18.         n--;
  19.     }
  20.     printf("nzd je %d", nzd);
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement