I/O Operations Professor Omkar

QUESTION DESCRIPTION 

Omkar is the Professor in SRM he has decided to give a simple task to his students.

He asked his students to create a logic for automatically calculating the amount of energy needed to head X amount of water from Y initial temperature to Z final temperature.

The formula to compute the energy is as follows

Q = M * (finalTemperature – initialTemperature) * 4184

Where,

M is the weight of water in kilograms,

Q is the energy measured in joules,

and

Temperatures are in degree Celsius.

Input Format:

Get the input of amount of water in kilograms , initial temperature of water and final temperature of the water.

Output Format:

Print the energy needed to heat the water.

Refer Sample Testcases

Programming Language need to be used:C++




TEST CASE 1 

INPUT
567 12 56
OUTPUT
The energy needed is 1.04382e+08

TEST CASE 2 

INPUT
734 0 37
OUTPUT
The energy needed is 1.13629e+08











#include <iostream>
using namespace std;
int main() {
 int m,f,i,g;
  float q;
  cin>>m;
  cin>>i;
  cin>>f;
  g=(f-i);
  q=m*g*4184;
  cout<<"The energy needed is "<<q;
 return 0;
}

Comments

Popular Posts