Advertisement
Guest User

Untitled

a guest
Jan 20th, 2018
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.45 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3.  
  4. int *podziel(void);
  5.  
  6. main()
  7. {
  8.     int i,k;
  9.     k=podziel();
  10.     printf("%d",k-1);
  11.    
  12. getche();
  13. }
  14.  
  15.  
  16. int *podziel(void)
  17. {      
  18.     int a,*t=NULL,p,k=1;
  19.     do
  20.     {
  21.         t=(int*)malloc(k*sizeof(int));
  22.         printf("Podaj liczbe");
  23.         fflush(stdin);
  24.         scanf("%d",&a);
  25.  
  26.         if((a-111)%1000==0 && a%5==0 ||(a+111)%1000==0 && a%5==0)
  27.         break;
  28.         else
  29.         {
  30.         *(t+k-1)=a;
  31.         k++;
  32.         t=(int*)realloc(t,k*sizeof(int));
  33.         }
  34.     }while(1);
  35. return k;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement