Water Requirement CodeChef Solution

Problem – Water Requirement CodeChef Solution

Finally, after purchasing a water cooler during the April long challenge, Chef noticed that his water cooler requires 2 liters of water to cool for one hour.

How much water (in liters) would be required by the cooler to cool for N hours?

Input Format

  • The first line of input will contain an integer T — the number of test cases. The description of T test cases follows.
  • The first and only line of each test case contains an integer N, as described in the problem statement.

Output Format

For each test case, output the number of liters of water required by the water cooler to cool for N hours.

Constraints

  • 1≤T≤1000
  • 1≤N≤1000

Sample 1:

Input: 2
1
2
Output: 2
4

Explanation:

Test case 1: As mentioned in the problem statement, 2 liters of water is required by the water cooler to cool for 1 hour.

Test case 2: 4 liters of water is required by the water cooler to cool for 2 hours.

Water Requirement CodeChef Solution in C++14

#include <iostream>
using namespace std;

int main() {
     int T; cin>>T;
     while(T--)
     {
         int n;
         cin>>n;
         cout<<2*n<<"\n";
     }
	return 0;
}

Water Requirement CodeChef Solution in Pyth 3

t=int(input())
for i in range(t):
    n=int(input())
    r=n*2
    print(r)

Water Requirement 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 scn= new Scanner(System.in);    
        int T= scn.nextInt();  
        
        for(int i=0; i<T;i++){
            int N= scn.nextInt();
            

        	    System.out.println(N*2);
    	}
	}
}
Water Requirement CodeChef Solution Review:

In our experience, we suggest you solve this Water Requirement 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 Water Requirement CodeChef Solution

Find on CodeChef

Conclusion:

I hope this Water Requirement 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.