import java.util.*;
public class qstn_1
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter the input ");
int n = sc.nextInt();
int n1 = n;
int count = 0;
if(n>1000)
{
System.out.println("INVALID INPUT");
System.exit(0);
}
if(n>=48)
{
int div = n/48;
n = n-div*48;
count = count + div;
}
if(n>=24)
{
int div = n/24;
n = n-div*24;
count = count + div;
}
if(n>=12)
{
int div = n/12;
n = n-div*12;
count = count + div;
}
if(n>=6)
{
int div = n/6;
n = n-div*6;
count = count + div;
}
System.out.println("Remaining boxes = "+n);
if(n!=0)
{
count++;
}
System.out.println("Total number of boxes = "+n1);
System.out.println("Total number of cartons = "+count);
}
}
No comments:
Post a Comment