304 North Cardinal St.
Dorchester Center, MA 02124

# Total Expenses CodeChef Solution

## Total Expenses CodeChef Solution in Ruby

``````# cook your code here
class Sum
def sum(a,b)
tv = (a*b).to_f
if a > 1000
tv = tv-(tv/10)
end
return tv
end
end

N = Sum.new
testcase = gets.chomp.to_i
testcase.times do
a,b = gets.chomp.split(' ').map(&:to_i)
puts N.sum(a,b)
end``````

## Total Expenses CodeChef Solution in C++14

``````#include <bits/stdc++.h>
#include<iostream>
using namespace std;

int main() {
int t;
cin>>t;
while(t--){
int q,p;
cin>>q>>p;
double s=q*p;
if(q>1000)
cout<<fixed<<s*0.9<<endl;
else
cout<<fixed<<s<<endl;
}

return 0;
}``````

## Total Expenses CodeChef Solution in PYTH 3

``````# cook your dish here
t=int(input())
for i in range(t):
a,b=map(int,input().split())
c=a*b
if a>1000:
dis=c-(c*0.1)
d=format(dis,'.6f')
print(d)
else:
cc=format(c,'.6f')
print(cc)
``````

## Total Expenses CodeChef Solution in C

``````#include <stdio.h>

int main(void) {
int t;
scanf("%d",&t);
while(t--){
float q,p;
scanf("%f%f",&q,&p);
if(q<1000)
printf("%f\n",q*p);
else
printf("%f\n",q*p*0.9);
}
return 0;
}
``````

## Total Expenses CodeChef Solution in JAVA

``````/* 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
{
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
for(int i=0;i<n;i++){
int a=sc.nextInt();
int b=sc.nextInt();
int c=a*b;
if(a<1000 && b<1000){
System.out.println(c+".000000");
}
else{
double dis = (a*b) * 0.1;
System.out.println(a*b-dis);
}
}
}
}
``````

## Total Expenses CodeChef Solution in PYPY 3

``````t=int(input())
for i in range(t):
a,b=map(int,input().split())
if a<=1000:
print(a*b)
else:
c=a*b
print(c-(c/10))``````

## Total Expenses CodeChef Solution in PYTH

``````# cook your code here
for i in range(int(input())):
(q,p)=map(int,raw_input().split(' '))
a=q*p*0.1
if q>1000:
print(q*p-a)
else:
print(q*p)``````

## Total Expenses CodeChef Solution in C#

``````using System;
using System.Linq;
public class Test
{
public static void Main()
{
while(test-- >0){

double expense =(lines[0] * lines[1]);
if(lines[0]>1000){
expense = expense - (expense*0.1);
}
Console.WriteLine(expense);
}
}
}``````

## Total Expenses CodeChef Solution in NODEJS

``````process.stdin.resume();
process.stdin.setEncoding('utf8');

let input = ''

function checkInput(data) {
input += data
}

function prepareInput() {
input = input.split('\n')
}

function main() {
prepareInput()

let N = input.splice(0, 1)

for(let i=0; i<N; i++) {
let [a, b] = input[i].split(' ').map(Number)

let ans = a <= 1000 ? a * b : (a * b) - (a *b / 10)

process.stdout.write(ans + '\n')
}
}

process.stdin.on('data', checkInput).on('end', main)``````

## Total Expenses CodeChef Solution in GO

``````package main

import "fmt"

func main() {
var t int
fmt.Scan(&t)
for i := 0; i < t; i++ {
var q, p float64
fmt.Scan(&q, &p)

pd := p * 10 / 100

if q > 1000 {
fmt.Println((q* p) - (pd *q))
}else {
fmt.Println(q * p)
}

}
}``````

##### Total Expenses CodeChef Solution Review:

In our experience, we suggest you solve this Total Expenses 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 CodeChef Solution.

Find on CodeChef

##### Conclusion:

I hope this 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 Programming Language in a business context; there are no prerequisites.

Keep Learning!