Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Study the program called \"Scale\" on page 143 of our book Problem Solving and P

ID: 3672762 • Letter: S

Question

Study the program called "Scale" on page 143 of our book Problem Solving and Program Design in C 8th Edition (Figure 3.24). This program uses a function called Scale to compute a scale value and returns that value to the calling module.

Open Visual Studio on your PC and select to create a New Project, name the new project Average, and set the Location to save to your flashdrive to your folder called MyProgramProjects.

Using the Scale program as a guide, write a new program that contains a function called Average to compute the average of two numbers (1 int and 1 double). Don't forget to add a line at the very top: #include "stdafx.h" (needed for Visual Studio software).

Save your program and Build it. Fix your errors (see the book for a guide) . Once you have the program working, test it out to see that your function yields the correct result. Please be sure to save your program to your flashdrive and demonstrate it for grading.

Explanation / Answer

See the below code for calculate the average of two numbers..

#include<stdio.h>
#include "stdafx.h"

int avregae(int a, int b);
int main()
{
   int a =5, b = 6;
   int result = avregae(a,b);
   printf("Average is: %d",result);
   return 1;
  
}

int avregae(int a, int b)
{
   return ((a+b)/2);
}