Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int i=1,k,xu,yu,par,nep,brp=0,brn=0,n,cif,pret,br=0;
- printf("Unesite k=");
- xu=wherex();
- yu=wherey();
- do{
- gotoxy(xu,yu);
- printf(" ");
- gotoxy(xu,yu);
- scanf("%d",&k);
- }while(k<=1);
- do{
- printf("\n(%d) Unesite prirodan broj n : ",i);
- xu=wherex();
- yu=wherey();
- do{
- gotoxy(xu,yu);
- printf(" ");
- gotoxy(xu,yu);
- n=0;
- do{
- do{
- cif=getch();
- }while(((cif<'0'||cif>'9')||(n==0&&cif=='0'))&&cif!=13);
- if(cif!=13){
- n=n*10+cif-48;
- printf("%c",cif);
- }
- }while(cif!=13);
- }while(n<1);
- if(i==1)nep=n,brp=1,pret=n,br=0;
- if(i==2)par=n,brn=1;
- if(i>2)
- {
- if(i%2==0)
- {
- if(n==par)brp++;
- else par=n,brp=1;
- }
- else
- {
- if(n==nep)brn++;
- else nep=n,brn=1;
- }
- }
- if(i>1&&n>pret)br++;
- pret=n;
- i++;
- }while(brp!=k&&brn!=k);
- printf("\n\n%d brojeva ima vrednost vecu od vrednosti svog prethodnika.",br);
- getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement