Sunday 16 August 2015

If the total selling price of 15 items and the total profit earned on item is input through the keyboard,WAP in java to find cost price of one item.

//Calculate cost price of a product

import java.util.Scanner;


public class Product_cp {
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter Selling price for 15 items(in total) and enter profit per item:");
float sp_t=sc.nextFloat();
float p=sc.nextFloat();

float cp=(sp_t/15)-p;
System.out.println("Cost price per item:"+cp);
}

}

No comments:

Post a Comment