Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Ex02 {
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- int x, cars;
- int price;
- System.out.println("enter number of persons: ");
- x = in.nextInt();
- // cars with 4 passengers
- cars = x / 4;
- // any one left ??
- if (x % 4 > 0) {
- // one more car
- cars = cars + 1;
- }
- System.out.println("cars = " + cars);
- price = 530 * cars;
- System.out.println("Total taxi price = " + price);
- System.out.println("person should pay " + price / x + " shekel");
- in.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement