➽ Problem:-
https://www.hackerrank.com/challenges/apple-and-orange/problem
➽ Solution:-
#include<stdio.h>
int main()
{
int a, b, c, d, x, y, apple, orange;
int apple_count=0, orange_count=0;
scanf("%d %d", &a, &b);
scanf("%d %d", &c, &d);
scanf("%d %d", &x, &y);
for(int i=0; i<x; i++)
{
scanf("%d", &apple);
if(c+apple >= a && c+apple
<= b)
apple_count++;
}
for(int i=0; i<y; i++)
{
scanf("%d", &orange);
if(d+orange >= a && d+orange
<= b)
orange_count++;
}
printf("%d\n", apple_count);
printf("%d", orange_count);
return 0;
}
0 Comments
Please do not enter any spam link in the comment section.