-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathconductor.java
More file actions
32 lines (25 loc) · 818 Bytes
/
conductor.java
File metadata and controls
32 lines (25 loc) · 818 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import java.util.Scanner;
public class conductor{
public static void main(){
int a[]={1,2,5,10,20,50,100,200};
int rem ,pro=0;
Scanner in = new Scanner(System.in);
System.out.print("Enter the amount you give to conductor :");
int amt= in.nextInt();
System.out.println("amt is: "+amt);
System.out.println("Enter the ticket value :");
int tic= in.nextInt();
System.out.println("tic is: "+tic);
rem=amt -tic;
for(int i=9;i>=0;i--){
if(rem>=a[i]){
pro++;
rem = rem- a[i];
}
else if(rem<a[i]){
continue;
}
}
System.out.println("Notes is:"+ pro);
}
}