Write a program to read cost of 10 pens and find the cost of 5 pens

Write a program to read cost of 10 pens and find the cost of 5 pens

About the author
Everleigh

2 thoughts on “Write a program to read cost of 10 pens and find the cost of 5 pens”

  1. Answer:

    import java.util.*;

    class cost

    {

    public static void main(String[] args)

    {

    Scanner sc=new Scanner(System.in);

    System.out.println(“enter the cost of 10 pens”);

    double cost = sc.nextInt();

    double cost_5 = cost/2;

    System.out.println(“Cost of 5 pens= “+cost_5);

    }

    }

    Step-by-step explanation:

    Reply

Leave a Comment