
In this post, you will get the solution to the Capgemini ADAPT 2022 solution to the problem of Change Using Minimal Coins/Notes in Java. Capgemini ADAPT Java Solutions 2022, Change Using Minimal Coins/Notes.
Note: The solutions are provided for learning purposes only.
Table of Contents
- Change Using Minimal Coins/Notes Problem Description:
- Capgemini ADAPT 2022 – Change Using Minimal Coins/Notes Problem Solution in Java:
- Top Companies + Batchwise Hiring Drive:
- To Stay Up-to-date, Follow us on Social Media:
- ADAPT Different Coding Solutions:
- Capgemini ADAPT Sprint 1 (Bus Reservation Solutions):
- Capgemini ADAPT Sprint 2 (Bus Reservation System):
- Study Materials for Interview Preparation (FREE MATERIALS):
Change Using Minimal Coins/Notes Problem Description:
Ram needs to pay the school fees of his 6-year-old kid. As he is busy with his work, he is not finding time to go to school to make payments. His kid’s school doesn’t accept online payment. So he decided to send the fee amount through his kid. The available denominations of rupees or coins are 500, 50, 10, 5, and 1. Can you write a program to find the minimal number of coins or notes to be given to his kid?
Input and Output Format:
Input consists of a single integer that corresponds to the fee amount to be paid.
The output consists of an integer that corresponds to the minimal number of coins or rupee notes.
Print Invalid Input if the input value is negative.
Sample Input 1:
682
Sample Output:
8
Sample Input 2:
-2345
Sample Output 2:
Invalid Input
Execution Time Limit:
10 seconds
Capgemini ADAPT 2022 – Change Using Minimal Coins/Notes Problem Solution in Java:
import java.util.scanner;
class Source{
public static void main(String args[]){
int a;
int b = 0, c = 0, d = 0, e = 0, f = 0, g = 0;
Scanner sc = new Scanner(System.in);
a = sc.nextInt();
if(a>0){
while (a>0){
if(a – 500 >= 0){
b++;
a = a – 500;
}else if (a – 100 >= 0){
c++;
a = a – 100;
} else if (a – 50 >= 0){
d++;
a = a – 50;
} else if (a – 10 >= 0){
e++;
a = a – 10;
} else if (a – 5 >= 0){
f++;
a = a – 5;
} else {
g++;
a = a – 1;
}
}
System.out.println(b+c+d+e+f+g);
} else {
System.out.println(“Invalid Input”);
}
}
}
Top Companies + Batchwise Hiring Drive:
TOP COMPANIES HIRING DRIVE |
BATCHWISE OFF-CAMPUS DRIVES |
1. TCS OFF-CAMPUS DRIVES | 1. 2018 BATCH |
2. INFOSYS OFF-CAMPUS DRIVES | 2. 2019 BATCH |
3. COGNIZANT OFF-CAMPUS DRIVES | 3. 2020 BATCH |
4. WIPRO OFF-CAMPUS DRIVES | 4. 2021 BATCH |
5. CAPGEMINI OFF-CAMPUS DRIVES | 5. 2022 BATCH |
To Stay Up-to-date, Follow us on Social Media:
1. Join our Telegram Channel: |
Click Here |
2. Like us on Facebook: |
Click Here |
3. Follow us on Instagram: |
Click Here |
4. Follow us on LinkedIn: |
Click Here |
5. Follow us on Google News: |
Click Here |
ADAPT Different Coding Solutions:
- Largest Array Solution – Click Here
- Batsman & Bowler Solution – Click Here
- Instruments Problem Solution – Click Here
- Check Two Person Are Same – Click Here
- Medicine App ADAPT Solution – Click Here
- String Combination Capgemini ADAPT Solution – Click Here
- Remove”X”inString Problem Solution – Click Here
- Customer and Invoice ADAPT Problem Solution – Click Here
- Book and Author Problem Solution – Click Here
- Highest Feedback Problem Solution – Click Here
- Registered Customer Problem Solution in Java – Click Here
- Product of Digits Problem Solution – Click Here
- Change Using Minimal Coins/Notes Solution in Java – Click Here
Capgemini ADAPT Sprint 1 (Bus Reservation Solutions):
- 1. Capgemini ADAPT Sprint 1 Bus Reservation System – DisplayCustomerInAscendingOrder Problem Solution
- 2. Capgemini ADAPT Sprint 1 Bus Reservation System – DisplayCustomerByFirstName Problem Solution
- 3. Capgemini ADAPT Sprint 1 Bus Reservation System – SortByCustomerId Problem Solution
- 4. Capgemini ADAPT Sprint 1 Solution Java | LSAByCustomerName Problem Solution
- 5. Capgemini ADAPT Sprint 1 Case Study Solution Java | BSAByCustomerId Problem Solution
Capgemini ADAPT Sprint 2 (Bus Reservation System):
- 1. Capgemini ADAPT Sprint 2 Case Study (Bus Reservation System) Solution | HAS-A-Relationship Solution Java
- 2. Capgemini ADAPT Sprint 2 Case Study (Bus Reservation System) Solution OOPs-Para-Constructor Java
- 3. Capgemini ADAPT Sprint 2 Bus Reservation System (CRUDOperations) Problem Solution
Study Materials for Interview Preparation (FREE MATERIALS):
- 240 Core Java Questions & Answers with PDF Download Link – Click Here
- 230+ SQL interview questions & answers pdf download – Click Here
- 50 LeetCode Interview Questions with Answers – PDF Notes – Click Here