how to write c++find the maximum,minimum,sum and average of 3 numbers

Here's a sample code to find the maximum, minimum, sum and average of 3 numbers:

```c++
#include <iostream>
using namespace std;

int main() {
int num1, num2, num3;
int sum, average;

// Input three numbers
cout << "Enter three numbers: ";
cin >> num1 >> num2 >> num3;

// Find maximum number
int max = num1;
if (num2 > max)
max = num2;
if (num3 > max)
max = num3;
cout << "Maximum number is " << max << endl;

// Find minimum number
int min = num1;
if (num2 < min)
min = num2;
if (num3 < min)
min = num3;
cout << "Minimum number is " << min << endl;

// Find sum
sum = num1 + num2 + num3;
cout << "Sum is " << sum << endl;

// Find average
average = sum / 3;
cout << "Average is " << average << endl;

return 0;
}
```

In this code, we first input three numbers using the `cin` statement. Then, we find the maximum and minimum using simple `if` statements. Next, we find the sum of the three numbers using the `+` operator and store it in the `sum` variable. Finally, we find the average by dividing the sum by 3 and store it in the `average` variable.

To find the maximum, minimum, sum, and average of three numbers in C++, you can follow these steps:

Step 1: Include the necessary header files. In this case, you need to include the iostream header for input/output operations.

```c++
#include <iostream>
using namespace std;
```

Step 2: Declare variables for the three numbers, maximum, minimum, sum, and average.

```c++
int num1, num2, num3;
int maximum, minimum, sum;
double average;
```

Step 3: Prompt the user to enter the three numbers and store them in the respective variables.

```c++
cout << "Enter first number: ";
cin >> num1;

cout << "Enter second number: ";
cin >> num2;

cout << "Enter third number: ";
cin >> num3;
```

Step 4: Find the maximum and minimum numbers among the three.

```c++
maximum = max(num1, max(num2, num3));
minimum = min(num1, min(num2, num3));
```

Step 5: Calculate the sum and average of the three numbers.

```c++
sum = num1 + num2 + num3;
average = sum / 3.0; // Casting sum to double for accurate average calculation
```

Step 6: Display the maximum, minimum, sum, and average to the user.

```c++
cout << "Maximum number: " << maximum << endl;
cout << "Minimum number: " << minimum << endl;
cout << "Sum of numbers: " << sum << endl;
cout << "Average of numbers: " << average << endl;
```

Step 7: End the program.

```c++
return 0;
```

Here is the complete code:

```c++
#include <iostream>
using namespace std;

int main() {
int num1, num2, num3;
int maximum, minimum, sum;
double average;

cout << "Enter first number: ";
cin >> num1;

cout << "Enter second number: ";
cin >> num2;

cout << "Enter third number: ";
cin >> num3;

maximum = max(num1, max(num2, num3));
minimum = min(num1, min(num2, num3));

sum = num1 + num2 + num3;
average = sum / 3.0;

cout << "Maximum number: " << maximum << endl;
cout << "Minimum number: " << minimum << endl;
cout << "Sum of numbers: " << sum << endl;
cout << "Average of numbers: " << average << endl;

return 0;
}
```

You can compile and run this code, and it will prompt you to enter three numbers. After entering the numbers, the program will output the maximum, minimum, sum, and average of those numbers.