Skip to content

Instantly share code, notes, and snippets.

@ulvimemmeedov
Created January 5, 2022 18:43
Show Gist options
  • Save ulvimemmeedov/4823880890ba6dea0ab11a325b76fbce to your computer and use it in GitHub Desktop.
Save ulvimemmeedov/4823880890ba6dea0ab11a325b76fbce to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#define MAX_HEIGHT 41
struct box
{
int length, width, height;
};
typedef struct box box;
void solution(box *boxes,int n){
for (int i = 0; i < n; i++)
{
if (boxes[i].height < MAX_HEIGHT)
{
int result = boxes[i].length * boxes[i].width * boxes[i].height;
printf("%d\n", result);
}
}
}
int main()
{
int n;
scanf("%d",&n);
box *boxes = malloc(n * sizeof(box));
for (int i = 0; i < n; i++)
{
scanf("%d%d%d", &boxes[i].length, &boxes[i].width, &boxes[i].height);
}
solution(boxes,n);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment