[SOLVED] COM1002 Lab 2

30.00 $

Category: Tags: ,
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon Lab-2-0fiz5z.zip (59.9 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
πŸ”’ Securely Powered by:
Secure Checkout
5/5 - (1 vote)

Write a C program that computes the maximum, minimum, sum and average of 3 integers. This program reads 3 integers and a character that specifies the math opera9on (x for maximum, m for minimum, s for sum, a for average) from command prompt and prints the result of the opera9on. The input/output format is provided below.

The output should be printed in integer format for x, m and s opera9ons; but in floa-ng point format for average (a) opera9on. Floa9ng points must be printed in 2 digits precision aDer the decimal point (See Hint below).

Input: <number 1>[space] <number 2>[space] <number 3>[space] <operaQon> Output: <computed value>
Example 1:
>15 3 28 m

>3

Example 2:

>20 32 4 s >56

Example 3:

>20 32 4 a >18.67

Hint: %.2f format specifier prints 2 digit precision for floa9ng point numbers.
Warning: Your source codes will be scanned by a program for chea9ng. Any form of chea9ng is

forbidden. Please write your own source codes and submit that!
Submission: Your source code will be named using your student ID: <student-id>.c Ex: if your id is 1123456 than you should name your source code like this: 1123456.c

  • Lab-2-0fiz5z.zip