Find Selling Price from given Profit Percentage and Cost | Java implementation of above approach ; Function to calculate the Selling Price ; Decimal Equivalent of Profit Percentage ; Find the Selling Price ; return the calculated Selling Price ; Driver code ; Get the CP and Profit % ; Printing the returned value
import java . util . * ; class solution { static float SellingPrice ( float CP , float PP ) { float P_decimal = 1 + ( PP / 100 ) ; float res = P_decimal * CP ; return res ; } public static void main ( String args [ ] ) { float C = 720 , P = 13 ; System . out . println ( SellingPrice ( C , P ) ) ; } }