Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /******************************************************************************
- Welcome to GDB Online.
- GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby,
- C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
- Code, Compile, Run and Debug online from anywhere in world.
- *******************************************************************************/
- #include <stdio.h>
- float calculate(float price, float percentage)
- {
- return (price*percentage)/100 ;
- }
- int main()
- {
- // מחיר המוצר
- float item_price;
- // אחוז ההנחה
- float discount_p;
- // הצגת הודעה למשתמש
- printf("Please enter item price: ");
- // קליטת ערכים מהמשתמש
- scanf("%f",&item_price);
- // הצגת הודעה למשתמש
- printf("\nPlease enter discount percentage: ");
- // קליטת אחוז הנחה מהמשתמש
- scanf("%f",&discount_p);
- // חישוב אחרי ההנחה
- float item_after_discount = item_price - calculate(item_price, discount_p);
- // חישוב אחרי התייקרות
- float item_after_adding = item_price + calculate(item_price, discount_p);
- // הצגה של המחירים
- printf("Item Price: %f \n", item_price);
- printf("Item Price after discount: %f \n", item_after_discount);
- printf("Item Price after adding: %f \n", item_after_adding);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement