Thursday

Write a C program to input cost price (CP) and selling price (SP) and determines whether there is gain or loss.

#include<stdio.h>
#include<conio.h>
void main()
  {
    float cp,sp;
    clrscr();
    printf("\nEnter Cost Price and Selling Price: ");
    scanf("%f%f",&cp,&sp);
    if(sp>cp)
     printf("Rs. %.2f is Profit",sp-cp);
    else
     printf("Rs. %.2f is Loss",cp-sp);
    getch();
  }

No comments:

Post a Comment

Rahul-Notes