Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int n, i;
- void funk(int niza[n], int clenovi)
- {
- int b, zbir=0, c, srednav;
- for(i=clenovi-1,b=0,c=0;i>=0;c++,i--,b++)
- {
- zbir+=niza[c];
- if (b==2)
- {
- srednav=zbir/3;
- printf("%d %d %d ", srednav, srednav, srednav);
- b=-1;
- zbir=0;
- Continue;
- }
- if(i==0&&(clenovi%3==1||clenovi%3==2))
- {
- if(clenovi%3==1)
- {
- printf("%d", niza[clenovi-1]);
- }
- else
- {
- zbir=0;
- zbir+=niza[clenovi-2];
- zbir+=niza[clenovi-1];
- srednav=zbir/2;
- printf("%d %d", srednav, srednav);
- }
- }
- }
- }
- int main()
- {
- printf("Vnesete kolku clenovi ke ima nizata:\n");
- scanf("%d", &n);
- int niza[n];
- printf("Vnesete gi vrednostite na nizata:\n");
- For (I = 0; I < n; I + +)
- {
- scanf("%d", &niza[i]);
- }
- Funk (String, n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement