Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int func(int n,int x, int* arr)
- {
- int suma = 0;
- for (int i = 0; i < n; i++)
- {
- if (arr[i] % x != 0)
- {
- arr[i] = arr[i] * arr[i];
- suma += arr[i];
- }
- }
- return suma;
- }
- void kolos1()
- {
- int n;
- int x;
- scanf("%d", &n);
- scanf("%d", &x);
- int *arr = (int*)malloc(sizeof(int)*n);
- for (int i = 0; i < n; i++)
- {
- arr[i] = rand() % 100;
- }
- for (int i = 0; i < n; i++)
- {
- printf("%d ", arr[i]);
- }
- printf("%d",func(n, x, arr));
- free(arr);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement