DevJourney · code I wrote while learning

Average Calculator

2 items

README.md

Average Calculator

Single File Programming Question

Problem Statement

Mr. Johnson wants a simple program that calculates and analyzes the average of three numbers. The program should then perform a specific operation based on whether the average is even or odd.

Create a file named data.txt. Write the user's input into data.txt. Read the data from data.txt, calculate the average of the three numbers, and write the result to average.txt.

If the average is even, display the square of the average with two decimal places. If the average is odd, display the cube of the average with two decimal places.

Input:

format :

The input consists of three integers separated by a space.

Output:

format :

The output displays the final result, either the square or cube of the average, with two decimal places.

Refer to the sample output for formatting specifications.

Code constraints : The given test cases fall under the following constraints:

1 ≤ input integers ≤ 50

Sample test cases :

Input 1:

2 4 6
Output 1 :
16.00
Input 2 :
3 2 4
Output 2 :
27.00