Profit and loss questions and answers java

  • Just focusing on quantitative aptitude questions to help freshers who are facing these questions in interviews and written test.
  • No need to allocate different time slot to prepare quantitative aptitude questions. We will help you to cover those formulas and provide problems with solutions as a java programs.
  • Hope it will help you.
Profit and loss:

  • Cost Price: The price, at which an product is purchased (CP).
  • Marked price: actual price or label price which shown on product.(MRP)
  • Selling price: The product sold price.(SP)
  • Profit: If  selling_price is greater than cost_price then its a profit.(selling_price-cost_price)
  • Loss: if  selling_price is less than cost_price then its a Loss.(cost_price-selling_price)
  • Discount:  marked_price-selling_price.
  • discount_percentage=((marked_price-selling_price)/marked_price)*100;
  • profit=selling_price-cost_price;
  • if(selling_price>cost_price)
  • profit_percentage=((selling_price-cost_price)/cost_price)*100;     
  • if(selling_price<cost_price)
  • loss_percentage=((cost_price-selling_price)/cost_price)*100;

 Problem 1#: If a product is bought for Rs.100. and sold for Rs.150 what is the profit percentage

  1. package com.javaQuantitaveQuestions;
  2.  
  3. /**
  4. * Quantitative aptitude questions
  5. * @author www.instanceofjava.com*/
  6. public class ProfitNLoss {
  7.  
  8. public static void main(String[] args) {
  9.  
  10.      double profit,profit_percentage=0;
  11.         
  12.         
  13.         double cost_price=100;
  14.         
  15.         double selling_price=150;
  16.         
  17.         if(selling_price>cost_price){
  18.         profit_percentage=((selling_price-cost_price)/cost_price)*100;
  19.         profit=selling_price-cost_price;
  20.         
  21.         System.out.println("Profit:="+profit+"\n profit Percentage:="+profit_percentage+"%");
  22. }
  23.  
  24. }

Output:


  1. Profit:=50.0
  2. profit Percentage:=50.0%
Problem 2#: If a product is bought for Rs.100. and sold for Rs.70 what is the loss and loss percentage

  1. package com.javaQuantitaveQuestions;
  2. /**
  3. * Quantitative aptitude questions
  4. * @author www.instanceofjava.com
  5. */
  6. public class ProfitNLoss {
  7.  
  8.     public static void main(String[] args) {
  9.  
  10.      double loss=0,loss_percentage=0;
  11.         
  12.         double cost_price=100;
  13.         
  14.         double selling_price=70;
  15.         
  16.         
  17.         if(selling_price<cost_price){
  18.             
  19.         loss=cost_price-selling_price;
  20.         loss_percentage=((cost_price-selling_price)/cost_price)*100;
  21.         System.out.println("Loss:="+loss+"\nLoss Percentage:="+loss_percentage+"%");
  22.         
  23.         }
  24.     }
  25.  
  26. }

Output:


  1. Profit:=50.0
  2. profit Percentage:=50.0%


Problem 3#: If a product is bought for Rs.100. and sold for Rs.70 what is the Discount and Discount percentage

  1. package com.javaQuantitaveQuestions;
  2.  
  3. /**
  4. * Quantitative aptitude questions
  5. * @author www.instanceofjava.com
  6. */
  7. public class ProfitNLoss {
  8.  
  9.     public static void main(String[] args) {
  10.  
  11.      double discount=0,discount_percentage=0;
  12.         
  13.         double marked_price=100;
  14.         
  15.         double selling_price=70;
  16.         
  17.         
  18.         discount=(marked_price-selling_price);
  19.         
  20.  discount_percentage=(discount/marked_price)*100;
  21. System.out.println("Discount:="+discount+"\ndiscount
  22. Percentage:="+Discount_percentage+"%");
  23.         
  24.     }
  25.  
  26. }

Output:


  1. Discount:=30.0
  2. Discount Percentage:=30.0%

Select Menu