Computer Science, asked by xANURAAGx, 11 months ago

A shopkeeper announces two successive discounts 20% and 10% on purchasing of goods on the Marked price write a program to input marked price and calculate the selling price of an article​

Answers

Answered by jyotikumari32
4

Answer:

A shopkeeper announces two successive discounts 20% and 10% on purchasing of goods on the marked price. Write a program to input marked price and calculate the selling price of an article.

import java.io.*;

public class KboatSuccessiveDiscount

{

public static void main(String args[]) throws IOException

{

InputStreamReader read = new InputStreamReader(System.in);

BufferedReader in = new BufferedReader(read);

System.out.print("Enter marked price: ");

double mp = Double.parseDouble(in.readLine());

double d1 = mp * 20 / 100.0;

double amt1 = mp - d1;

double d2 = amt1 * 10 / 100.0;

double amt2 = amt1 - d2;

System.out.print("Selling Price = " + amt2);

}

}

Answered by dreamrob
10

Program in C++

#include<iostream>

using namespace std;

int main()

{

double M, S;

cout<<"Enter the Marked Price : ";

cin>>M;

S = M - (M * 20.0 / 100.0);

S = S - (S * 10.0 / 100.0);

cout<<"Selling Price = "<<S;

return 0;

}

Program in Java

import java.util.*;

public class MyClass

{

   public static void main(String args[])

   {

       Scanner Sc = new Scanner(System.in);

       double M, S;

       System.out.print("Enter the Marked Price : ");

       M = Sc.nextDouble();

       S = M - (M * 20.0 / 100.0);

       S = S - (S * 10.0 / 100.0);

       System.out.print("Selling Price = " + S);

   }

}

Output:

Enter the Marked Price : 100

Selling Price = 72.0

Similar questions