Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. #define n 10
  5. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  6.  
  7. int main() {
  8. int i,x,y;
  9. int a[n-1];
  10. srand (time(0));
  11. for( i=0;i<n-1;i++){
  12.   a[i]=rand()%10- 5;
  13.   printf ("%d\n ",a[i]);
  14. }
  15. int f=0;
  16. for(i=0;i<n-1;i++){
  17. for(y=i;y<n-1;y++){
  18. if(a[i]+a[y]==0)
  19.  {f++;
  20.  }
  21. for ( i=0 ; i < n-1; i++)
  22. {
  23.   a[i] = a[i + 1];
  24.   n-1--;
  25. }
  26. }
  27. }
  28. printf("kilkist par %d",f);
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement