Saturday, April 29, 2023

Calaulation of Profit and loss of a seller in a marcket .

 //find a seller is able to profit or not 

#include "stdio.h"

int main (){

int ap,sp,pft,lss;    /*ap=actual price ;sp=selling price ;pft=profit  ;lss=loss;*/

printf ("Enter the actual price and selling price of an item :\n");

scanf ("%i%i",&ap,&sp);

    if(sp>ap)

{

pft=sp-ap;

printf ("the profit is :%d\n",pft);

}

else if (ap>sp){

lss=ap-sp;

printf ("the loss is %d\n",lss);

}

else {

printf ("no profit no loss");   // as ap=sp

}

return 0;

}


                output output output output

Enter the actual price and selling price of an item :

23

34

the profit is :11

                                or 

Enter the actual price and selling price of an item :
54
52
the loss is 2

                                 or 

Enter the actual price and selling price of an item :
34
34
no profit no loss.

No comments:

Post a Comment

print a multiplication table of any integer taking from user

 // print a multiplication table of any integer taking from user  #include "stdio.h" int main () { int n,mul,i; printf ("...