SCHOOL OF CODE BUILDERS
Learn To CODE. Become A DEVELOPER.
Pages
HOME
DATA STRUCTURES
STRINGS
ARRAYS
MATRIX
BINARY TREES
LINKED LIST
STACK
QUEUE
SORTING
SEARCHING
C
PYTHON
PSEUDOCODE
CONTEST PROBLEMS
ALGORITHMS
PATTERNS
PHP
C PUZZLES
C INTERVIEW QUESTIONS
JAVA
C++
HASHING
RECURSION
BASIC C PROGRAMS
TCS-CODEVITA
FACEBOOK
CONTACT US
C program to calculate profit and loss
C program to calculate profit and loss
Output:
Enter Cost Price of the article you bought: 100
Enter Selling Price of the same article you sold at: 500
Profit Percentage = 400
Implementation:
#include
int main(void) { int cost_price,selling_price,profit,loss; printf("Enter Cost Price of the article you bought:\n"); scanf("%d",&cost_price); printf("Enter Selling Price of the same article you sold at:\n"); scanf("%d",&selling_price); if(selling_price>cost_price) { profit=((selling_price-cost_price)/cost_price)*100; printf("Profit Percentage = %d",profit); } else { loss=((cost_price-selling_price)/selling_price)*100; printf("Loss Percentage = %d",loss); } return 0; }
PREVIOUS
NEXT
HOME