Solution to A company is planning to provide an extra discount to it's customers. Every order has … - Sikademy
Author Image

Archangel Macsika

A company is planning to provide an extra discount to it's customers. Every order has an order ID associated with it which is a sequence of digits. The discount is calculated as the count of unique repeating digits in the order ID. Write a code to find the discount percentile given to the customers.

The Answer to the Question
is below this banner.

Can't find a solution anywhere?

NEED A FAST ANSWER TO ANY QUESTION OR ASSIGNMENT?

Get the Answers Now!

You will get a detailed answer to your question or assignment in the shortest time possible.

Here's the Solution to this Question


#include <iostream> using namespace std; int main() {     int customer;     int discount=0;     int digits[10] = {0,0,0,0,0,0,0,0,0,0};     cin >> customer;         while (customer > 0) {         digits[customer%10]++;         customer /= 10;     }     for (int i = 0; i < 10; i++) {         if (digits[i] >= 2) {             discount++;         }     }     cout << discount << endl;     return 0; }

Related Answers

Was this answer helpful?

Join our Community to stay in the know

Get updates for similar and other helpful Answers

Question ID: mtid-3-stid-44-sqid-1040-qpid-36