Pages

Friday, March 21, 2025

code to calculate bill of things (gst 18% included)

#include<iostream>
using namespace std;

//code to calculate bill of 3 things
int main() {
    float pencil;
    float pen;
    float eraser;

    cout<<"enter pencil price: ";
    cin>>pencil;

    cout<<"enter pen price: ";
    cin>>pen;

    cout<<"enter eraser price: ";
    cin>>eraser;

    float bill = pencil+pen+eraser;
    float gst = bill*0.18;  // gst calculation
    float gstbill = bill+gst; // final bill after gst

    cout<<"total bill (before gst)= "<<bill<<endl;
    cout<<"total bill (after gst)= "<<gstbill<<endl;

    return 0;
}

No comments:

Post a Comment

3Sum - Leetcode solution - How i turned into two-pointer approach?

  class Solution {     public List < List < Integer >> threeSum ( int [] nums ) {         Arrays . sort (nums); // first sort...