Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- #define n 10
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- int main() {
- int i,x,y;
- int a[n-1];
- srand (time(0));
- for( i=0;i<n-1;i++){
- a[i]=rand()%10- 5;
- printf ("%d\n ",a[i]);
- }
- int f=0;
- for(i=0;i<n-1;i++){
- for(y=i;y<n-1;y++){
- if(a[i]+a[y]==0)
- {f++;
- }
- for ( i=0 ; i < n-1; i++)
- {
- a[i] = a[i + 1];
- n-1--;
- }
- }
- }
- printf("kilkist par %d",f);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement