Computer Science, asked by mahendrashuklapaseh4, 11 months ago

a tour and travel company is organizing a picnic for your school.the student will commute through mini buses,each having a seating capacity of 25 students.create a java program that will accept the number of students and display the minimum number of cab required.it will also display the number of students sitting in the last cab.

Answers

Answered by saurabh000345
3
import java.io.*;
public class EasyPieceOfCode
{
      public static void main(String[] args) throws IOException{
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            System.out.println("Enter the number of students: ");
            int n = Integer.parseInt(br.readLine());
            int reqCabs = (int)(Math.ceil(n/25.0));
            int lastCabStudents = n % 25;
            System.out.println(reqCabs + " cabs will be required and " + lastCabStudents + " students will be seated in the last cab");
      }
}

// I hope this will do... do let me know if there are any errors to be fixed... in case of a compile error... let me know the message...
Similar questions