Answer the question
In order to leave comments, you need to log in
How to get the correct value?
The program should calculate the damage to the "company", but it gives incorrect values (Zeros).
#define _CRT_SECURE_NO_WARNINGS
#include <Windows.h>
#include <stdio.h>
#include <math.h>
#include <conio.h>
void MaxZbutok(int array[], int number_of_elemets)
{
int i = 0, k = 0, z = 0;
for (i = 0; i <= number_of_elemets; i++) {
if (&array[i] < 0)
{
z = array[i];
k += z;
}
}
printf("Максимальний збиток - %d\n", k);
}
int main()
{
int Nokia[6] = { 2300,2700,6000,3455,-2345,-6667 };
int Samsung[6] = { 3000,5000,4888,2933,-1000,-6621 };
int Honor[6] = { 2599,3000,-2566,-9999,5999,3000 };
MaxZbutok(Nokia, 6);
MaxZbutok(Samsung, 6);
MaxZbutok(Honor, 6);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question