Computer Science, asked by rupaynmukherjee, 8 months ago

Write a program to calculate and display the selling price of an item in python using formula Sp=Cp+profit

Answers

Answered by anindyaadhikari13
3

Solution:

The given code is written in Python.

cp = float(input('Enter the cost price: '))

profit = float(input('Enter the profit: '))

sp = cp + profit

print('Selling price =', sp)

Explanation:

  • Line 1: Accepts the cost price of the item.
  • Line 2: Accepts the gain value from the user.
  • Line 3: Calculates selling price using formula SP = CP + Gain.
  • Line 4: Displays the selling price.

Note:

  • input() function is used to take string as input.
  • float() function converts the input to float value.
  • print() function prints a text/message on screen.

Output is attached.

Attachments:
Similar questions