Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <conio.h>
- float findNumberMax(float [10]);
- float findMax(float a[10]);
- void main()
- {
- float a[10];
- int i;
- float sum = 0;
- printf("Input elements of array");
- for (i = 0; i < 10; i++)
- {
- printf("a[%d] = ", i);
- scanf("%f", &a[i]);
- }
- for (i = findNumberMax(a[10]); i < 10; i++)
- {
- if (a[i] > (findMax(a[10]) / 2) && (i - findNumberMax(a[10])) % 2 == 0)
- {
- sum += a[i];
- }
- }
- printf("%f", sum);
- }
- int findNumberMax(float a[10])
- {
- int maxi;
- for (int i = 0; i < 10; i++)
- {
- if (a[i] = findMax(a[10]))
- {
- maxi = i;
- }
- }
- return maxi;
- }
- float findMax(float a[10])
- {
- double max = (-1)*pow(10,38) - 1;
- for (int i = 0; i < 10; i++)
- {
- if (a[i] > max)
- {
- max = a[i];
- }
- }
- return max;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement