Edwin and Change(Practice Hots)

 import java.util.*;

public class Main {
    public static void main(String[] args) {
           Scanner  s= new Scanner(System.in);
        int n,b=0;
        n=s.nextInt();
        while(n!=0) {
            if(n>=100) {
                b+=n/100;
                n=n%100;
            }
            else if(n>=50 && n<100) {
                b+=n/50;
                n=n%50;
            }
            else if(n>=10 && n<50) {
                b+=n/10;
                n=n%10;





          }
            else if(n>=5 && n<10) {
                b+=n/5;
                n=n%5;





          }
            else if(n>=2 && n<5) {
                b+=n/2;
                n=n%2;





          }
            else {
                b+=n/1;
                n=n%1;





          }
                
                
        }
        
        System.out.println(b);
     }

}

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.