Discount CodeChef Solution

Problem – Discount CodeChef Solution

Alice buys a toy with a selling price of 100 rupees. There is a discount of x percent on the toy. Find the amount Alice needs to pay for it.

Input Format

  • The first line of input will contain a single integer T, denoting the number of test cases.
  • The first and only line of each test case contains a single integer, x — the discount on the toy.

Output Format

For each test case, output on a new line the price that Alice needs to pay.

Constraints

  • 1≤T≤100
  • 0≤x<100

Sample 1:

Input: 4
5
9
11
21
Output: 95
91
89
79

Explanation:

Test case 1: The discount is 5 percent, i.e. 5 rupees. So, Alice will have to pay 100−5=95 rupees.

Discount CodeChef Solution in Pyth 3

for _ in range(int(input())):
    a=int(input())
    print(100-a)

Discount CodeChef Solution in C++17

#include<iostream>
using namespace std;
int main()
{
	int t;
	cin>>t;
	if(t>=1&&t<=100)
	{
		while(t--)
		{
			int x;
			cin>>x;
			cout<<(100-(100*0.01*x))<<endl;
		}
	}
	return 0;
}

Discount CodeChef Solution in Java

import java.util.*;
import java.lang.*;
import java.io.*;

class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc=new Scanner (System.in);
		int t=sc.nextInt() ;
		
		while(t-->0){
		    int n=sc.nextInt() ;
		    
		    System.out.println(100-n);
		}
	}
}
Discount CodeChef Solution Review:

In our experience, we suggest you solve this Discount CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

If you are stuck anywhere between any coding problem, just visit Queslers to get the Discount CodeChef Solution

Find on CodeChef

Conclusion:

I hope this Discount CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.

This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.

Keep Learning!

More Coding Solutions >>

LeetCode Solutions

Hacker Rank Solutions

CodeChef Solutions

Leave a Reply

Your email address will not be published.