Question: #include #include //Function for the calculate the area float computeArea (int *v1, int *v2, int shape) { //Declare Variables float areaComputed=0; //Getting integer values to

#include

#include

//Function for the calculate the area

float computeArea (int *v1, int *v2, int shape)

{

//Declare Variables

float areaComputed=0;

//Getting integer values to float values

float var1=(float)*v1;

float var2=(float)*v2;

//If shape value equals to 1, then it will be a triangle and area is calculated as follows

if(shape==1)

{

areaComputed=0.5*var1*var2;

}

//If the shape value equal 2, then it will be a square or rectangle, and the area is calculated as follows

else if(shape==2)

{

areaComputed=var1*var2;

}

//If shape value equals 3, then it will be a circle, and the area is calculated as follows

else if(shape==3)

{

areaComputed=3.14159*(var1*var1)/4; //Here value of pi is considered as 3.14159

}

//When the argument related to the shape went wrong, it will be shown as an invalid input.

else

{

printf("Invalid Input" );

}

return(areaComputed); //return the computed area

}

//Function for counting the number of characters that include in the string

int numTimesAppears(char *mystring, char ch)

{

//Declare the Variables

int i;

int count=0;

//Getting the length of string using strlen

int string_length= strlen(mystring);

//find the number of characters using loop

for(i=0;i

{

if(mystring[i]==ch)

{

count++;

}

}

return(count); //return the count value

}

Code not running in C code#include #include //Function for the calculate the area float computeArea (int *v1,

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!