SR UNIVERSITY
SCHOOL OF ENGINEERING
Course-B.Tech Type-Programming Elective
Course Code-24CS203ES103 Course Name-Problem Solving using C++
Year-2024-2025 Semester-Even
Date Batch– ME & CE Batches
Week 9.2
Topics: Functions
Questions:
A. Write a C++ program that defines a function to compute the efficiency of a heat engine, given
the heat input and work output.
η=(Heat Input/Work Output)×100
Sample Input/Output
Enter heat input (in J): 2000
Enter work output (in J): 800
Efficiency: 40%
B. Write a C++ program that defines a function to calculate torque when force and radius are
given.
T=Force × Radius
Sample Input/Output:
Enter force (in N): 50
Enter radius (in m): 0.5
Torque: 25 Nm
C. Write a C++ program that defines a function to compute the power transmitted by a rotating
shaft, given torque and speed (RPM).
P= (2π×Torque×RPM)/ 60
Sample Input/ Output:
Enter torque (in Nm): 10
Enter speed (in RPM): 1200
Power: 1256.64 W