Click the Follow Button

C; Profit or lose

 PROGRAM:

#include <stdio.h>

int main ()
{
    int cp, sp;
    printf("enter cost price: ");
    scanf("%d", &cp);
    printf("enter selling price: ");
    scanf("%d", &sp);

    if (cp<sp)
    {
        printf("You have made profit of %d.", sp - cp );
    }
    else
    {
        printf("You have made lose of %d.", cp - sp );
    }
}

OUTPUT:

enter cost price: 5

enter selling price: 10

You have made profit of 5.

Comments

Popular Posts

TIC - TAC - TOE

Prime and not prime number

do_while loop is to do something again and again