write a program to input profit and costprice of an article and its selling price.
Answers
Answer:
the Cost price C and Profit Percentage P of an item, the task is to calculate the Selling Price. Examples: Input: CP = 500 .
Explanation:
#include <stdio.h>
int main() {
int costPrice, sellingPrice;
/*
* Take costPrice and SellingPrice as input from user
*/
printf("Enter Cost Price and Selling Price\n");
scanf("%d %d", &costPrice, &sellingPrice);
if(costPrice > sellingPrice) {
/* Loss */
printf("Loss = %d\n", costPrice - sellingPrice);
} else if(sellingPrice > costPrice) {
/* Profit or Gain*/
printf("Profit = %d\n", sellingPrice - costPrice);
} else {
/* No Profit or Loss*/
printf("No Profit and No Loss\n");
}
return 0;
}