- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# C++ code to find out if everyone will get ice cream

Suppose, there are three groups of people coming to a party. The first group of people likes butterscotch ice cream and do not like any other flavors of ice cream, the second group of people only dislikes strawberry ice cream and like every other flavor, and the third group likes all kinds of ice cream. Now, there are x people of the first group, y people of the second group, and z people of the third group are coming to a party, and everyone should have at least one icecream of their liking. The party organizers have brought a packs of butterscotch ice cream, b packs of chocolate ice cream, and c packs of strawberry ice cream. We have to find out if all the people at the party will be able to get one piece of their favorite ice cream or not.

So, if the input is like a = 6, b = 5, c = 5, x = 3, y = 8, z = 4, then the output will be Possible.

## Steps

To solve this, we will follow these steps −

if a < x or a + b < x + y or a + b + c < x + y + z, then: print("Not Possible.") Otherwise print("Possible.")

## Example

Let us see the following implementation to get better understanding −

#include <bits/stdc++.h> using namespace std; #define N 100 void solve(int a, int b, int c, int x, int y, int z) { if (a < x || a + b < x + y || a + b + c < x + y + z) cout<<"Not Possible."; else cout<<"Possible."; } int main() { int a = 6, b = 5, c = 5, x = 3, y = 8, z = 4; solve(a, b, c, x, y, z); return 0; }

## Input

6, 5, 5, 3, 8, 4

## Output

Possible.

- Related Questions & Answers
- Program to find maximum ice cream bars in Python
- What ice-cream flavor is absolutely disgusting?
- How can we make a fruity ice-cream at home?
- How long can a home-made ice-cream stay fresh?
- Why is vanilla ice cream white when vanilla extract is brown?
- C++ code to find out if a grid is fully accessible
- C++ code to find out if a name is male or female
- C++ code to find out if an image is B/W or color
- How to find out the PLANS which will be impacted if a index is dropped?
- C++ code to find out number of battery combos
- C++ code to find how long person will alive between presses
- C++ code to count children who will get ball after each throw
- C++ code to find out which number can be greater
- C++ code to find out who won an n-round game
- How to Find out the source code of a transaction in SAP?