Created
May 5, 2022 19:25
-
-
Save wakoliVotes/49a794faec573aecaa02e9a48a414786 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
// Declaring variables | |
int Qty, disc = 0; | |
float rate, totalExp; | |
// Getting input values and storing them | |
printf("Enter Qunatity and Rate: "); | |
scanf("%d %f", &Qty, &rate); | |
// Now adding if statement to the problem | |
if (Qty > 100) | |
disc = 10; // Discount is in percent | |
// Calculating total | |
totalExp = (Qty*rate) - (Qty*rate*disc/100); // Divided by 100 for % | |
printf("The Total Expense is: %.2f", totalExp); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment