Programming Examples

Java program to input selling price of 15 items and profit amount then find the cost price

If the total selling price of 15 items and the total profit earned on them is input through the

keyboard, write a program to find the cost price of one item.


import java.util.*;
class Price
	public static void main(String arr[])
		Scanner sc=new Scanner(;
		float tsp,tp,tcp,cp;
		System.out.println(“Enter the total selling price:”);
		System.out.println(“Enter the total profit:”);
		tcp=tsp-tp; //total cost price
		cp=tcp/15; //cost price of one item
		System.out.println(“Cost Price of one item:”+cp);

CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz