Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Chef went shopping and bought items worth X rupees (1≤X≤100). Unfortunately, Chef only has a single 100 rupees note.
Since Chef is weak at maths, can you help Chef in calculating what money he should get back after paying 100 rupees for those items?
For each test case, output in a single line the money Chef has to receive back.
Input: 3
1
25
100
Output: 99
75
0
Test case-1: Since chef paid 100 rupees for items worth 1 rupee. He should get back 99 rupees.
Test case-2: Since chef paid 100 rupees for items worth 25 rupees. He should get back 75 rupees.
#include <iostream>
using namespace std;
int main() {
// your code goes here
int T;
cin>>T;
while(T--)
{
int X;
cin>>X;
cout<<(100-X)<<endl;
}
return 0;
}
# cook your dish here
n=int(input())
for i in range(n):
b=int(input())
print(100-b)
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t>0){
int x = sc.nextInt();
System.out.println(x<=100?100-x:0);
t--;
}
}
}
In our experience, we suggest you solve this Shopping Change 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 Shopping Change CodeChef Solution
I hope this Shopping Change 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 >>