Thursday, November 7, 2019

ISC COMPUTER SCIENCE QUESTION PRACTICAL PAPER 2017| QUESTION NUMBER 1 | Follow on youtube for more |



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

ICSE COMPUTER SCIENCE SPECIMEN PAPER | QUESTION 7 | PLEASE DO WATCH THE VIDEO

  import  java.util.*; class icse_specimen_1 {     public static void main(String[] args)     {         Scanner sc1 = new Scanner(System.in)...