Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int xu,yu,k,a,b,i=1,broj,cif,broj1;
- float s;
- printf("Unesite k (k>2): ");
- xu=wherex();
- yu=wherey();
- do{
- gotoxy(xu,yu);
- printf(" ");
- gotoxy(xu,yu);
- scanf("%d",&k);
- }while(k<=2);
- do{
- if(i==1)a=1,b=0;
- else{
- a=a+b;
- b=a-b;
- }
- i++;
- }while(i<=k);
- i=1;
- do{
- printf("\nUnesite broj %d: ",i);
- broj=0;
- do{
- do{
- cif=getch();
- }while(((cif<'0'||cif>'9')||(broj==0&&cif=='0'))&&cif!=13);
- if(cif!=13){
- broj=broj*10+cif-48;
- printf("%c",cif);
- }
- }while(cif!=13);
- s+=broj;
- i++;
- }while(broj!=a);
- printf("\n\nSrednja vrednost unetih brojeva: %g\n",s/(i-1));
- getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement