Computer Science, asked by sravani53215, 10 months ago


Arun wants to buy a shirt. As he is very lazy, he decided to buy the shirt online. He chooses a shirt in Flipkart and is surprised to see the same shirt in Amazon and Snapdeal as well. So he decided to buy the shirt from the website which offers it at the least price. The price of the shirt, discount % and the shipping charges of all three websites have been given as input. Help him in calculating the price of the shirt in each website and decide which website has the lowest price.

INPUT & OUTPUT FORMAT:

Input consist of 9 integers. First three input corresponds to Flipkart details such as the amount of the shirt, discount offered and shipping charges. Next three input corresponds to Snapdeal details such as the amount of shirt, discount offered and shipping charge. Last three input corresponds to amazon details such as the amount of shirt, discount offered and shipping charge.

SAMPLE INPUT:

1000

50

50

900

50

70

800

10

200

SAMPLE OUTPUT:

In Flipkart: Rs.550

In Snapdeal: Rs.520

In Amazon: Rs.920

He will prefer Snapdeal

Answers

Answered by mayankpathak4513
23

Answer:Required code for the problem:

#include<iostream>

using namespace std;

int main()

{

 int a,b,c,l,m,n,x,y,z;

 std::cin>>a>>b>>c>>l>>m>>n>>x>>y>>z;

 int d1=(a*b)/100;

 int t1= a-d1+c;

 int d2=(l*m)/100;

 int t2= l-d2+n;

 int d3= (x*y)/100;

 int t3= x-d3+z;

 std::cout<<"In Flipkart Rs."<<t1<<"\n";

 std::cout<<"In Snapdeal Rs."<<t2<<"\n";

 std::cout<<"In Amazon Rs."<<t3<<"\n";

 if(t1<=t2 && t1<=t3)

   std::cout<<"He will prefer Flipkart";

 else if(t2<=t3 && t2<=t1)

   std::cout<<"He will prefer Snapdeal";

 else  

   std::cout<<"He will prefer Amazon";

}

Explanation:

Answered by ajinkyabiyani
8

Answer:

#include<iostream>

using namespace std;

int main()

{

 int a,b,c,l,m,n,x,y,z;

 std::cin>>a>>b>>c>>l>>m>>n>>x>>y>>z;

 int d1=(a*b)/100;

 int t1= a-d1+c;

 int d2=(l*m)/100;

 int t2= l-d2+n;

 int d3= (x*y)/100;

 int t3= x-d3+z;

 std::cout<<"In Flipkart Rs."<<t1<<"\n";

 std::cout<<"In Snapdeal Rs."<<t2<<"\n";

 std::cout<<"In Amazon Rs."<<t3<<"\n";

 if

   (t1<=t2 && t1<=t3)

   std::cout<<"He will prefer Flipkart";

 else if

   (t2<=t3 && t2<=t1)

   std::cout<<"He will prefer Snapdeal";

 else  

   std::cout<<"He will prefer Amazon";

}

Explanation:

Similar questions