Header Ads

Header ADS

URI 1038 Snack Solution in C++

URI 1038 👀 Snack  👀Solution in C++

Before seeing the solution make sure that you tried enough. Don’t paste the whole code, just find out the logic. If you stuck in trouble, just inform me on comment.


https://programminglife77.blogspot.com/2018/10/uri-1038-snack-solution-in-c.html
Add caption


URI 1038 👀 Snack  👀Solution in C++

#include<bits/stdc++.h>
using namespace std;

int main(){
    int x,y;
    double x1=4.00,x2=4.50,x3=5.00,x4=2.00,x5=1.50,ans=0;

    cin>>x>>y;
    if(x==1){
        ans=x1*y;
    }else if(x==2){
        ans=x2*y;
    }else if(x==3){
        ans=x3*y;
    }else if(x==4){
        ans=x4*y;
    }else if(x==5){
        ans=x5*y;
    }
    cout<<fixed;
    cout<<setprecision(2)<<"Total: R$ "<<ans<<endl;


return 0;}

No comments

URI 1070 Six Odd Numbers Solution in C++

URI 1070 Six Odd Numbers Solution in C++ Before seeing the solution make sure that you tried enough. Don’t paste the whole code, just fin...

Powered by Blogger.