Write a C Program to Calculate the Profit Amount and Profit Percentage

In this tutorial learn how you can calculate the profit amount and profit percentage. Here are the profit and profit percentage formulas.

Profit=S.P-C.P, where S.P is selling price and C.P, is cost price.

Profit Percentage= (Profit/C.P)*100

Example: A shopkeeper buys a scientific calculator for Rs. 990 and sells in Rs. 1120. Write a program to calculate the profit amount and profit percentage.

C programming is a powerful general-purpose programming language. It can be used to develop software like operating systems, databases, compilers, etc.


write a c program to calculate the profit amount and profit percentage


Write a Program to Calculate the Profit Amount and Profit Percentage

Here is the code to calculate the profit amount and profit percentage in C programming.

#include <stdio.h> //A shopkeeper buys a scientific calculator for Rs. 990 and sells in Rs. 1120. Write a program to calculate the profit amount and profit percentage.
int main(){
int cp=990, sp=1120;
float profit,profit_per;
profit=sp-cp;
profit_per=(profit*100)/cp;
printf("The profit is:%.2f and profit percentage %.2f%%.",profit,profit_per);
return 0;
}

Test Live At Jdoodle


Conclusion

This is how you can find calculate the profit amount and profit percentage in c programming. Comment below if you like our tutorial.

Leave a Comment

Your email address will not be published. Required fields are marked *