In primary mathematics classes, you all have learned about profit and loss.
If cost price is greater than selling price, then there is a loss otherwise profit
Can you kindly automate the same?
Input:
First Line : Integer representing the Cost price
Second Line: Integer representing Selling Price
Output:
If Cost Price > Selling Price Print a “Loss” along with the amount of loss.
If Cost Price < Selling Price Print as "Profit" along with the amount of profit.
If Cost Price = Selling Price Print “No Profit No Loss”
#include <stdio.h> int main() {int cp,sp,amt; scanf("%d%d",&cp,&sp); if(sp>cp) { amt=sp-cp; printf("Profit:%d",amt); } else if(cp>sp) { amt=cp-sp; printf("Loss:%d",amt); } else { printf("No Profit No Loss"); } return 0; }
INPUT_1:
15945
13785
OUTPUT:
Loss:2160
INPUT_2:
26832
28513
OUTPUT:
Profit:1681
Morae! Q
- Find a triplet such that triplet is minimum of all the triplets.
- Rearrange characters in a string such that no two adjacent are same.
- Return the coordinates of all cells in matrix sorted by their distance.
- Function to verify the ISBN number from the book.
- Find out the absolute difference of values of two array integers.
- Rotate the array in the right direction by K steps.
- Find the sequence of moves that wins the game, collect exactly G coins!.
- Calculate the sum of boundary elements of a matrix.
- Find the total number of ways to reach the tree house.
- Compute profit and loss of a product.
- Find the total expense of purchased items.
- Determine the maximum sequence weight.
- Find the person’s birth year is a leap year or not.
- Find the inner rating with the displayed rating.
- Find if angles are valid to form a triangle.
- Find out the winner of the game from the given statistics.
- Verify the tag to determine if one needs to arrest or allow the vehicle.
- Find the largest hexadecimal number.
- Group up all anagrams together from given words.
- Return all anagrams from the given words.