Saturday, 25 March 2017

Hacker Rank Solution Program In C++ For " Day 2: Operators "

Problem :- Day 2: Operators

Submit Your Solution Here :- Click Here

Copy The Color Code and paste it into hackerrank Editor .

Solution :-

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

int main() {
    double meal;
    int tipp,taxp,total;
    cin>>meal>>tipp>>taxp;
    tipp=round(meal*tipp/100);
    taxp=(meal*taxp/100);
    total=meal+tipp+taxp;
    cout<<"The total meal cost is "<<total+1<<" dollars.";
    return 0;
}


Output :-

Hacker Rank Solution Program In C++ For " Day 2: Operators "

No comments:
Write comments

Recommended Posts × +