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

13. Write a C program that implements the following flowchart Start Start add) G

ID: 3895780 • Letter: 1

Question

13. Write a C program that implements the following flowchart Start Start add) Get Tow Numbers: a, b Start displnfo() Input: a, b Display The following: Press 1 to perform Add Press 2 to perform Sub Press 3 to perform Mul Press 4 to perform Div Call function: displnfo() output a+b return output Get: input value If value1? Yes End Call function add() No add() retum value If value 2? Yes End displnfo() Call function: sub() No If value3? Yes Call function: mul) If value4? Yes Call function: div() No Display: Inval id Value Display output End

Explanation / Answer

The C program of the following flowchart is:

#include<stdio.h>
int main()
{
int a,b,value;
float output;
printf("enter the 2 numbers: ");
scanf("%d%d",&a,&b);
float add()
{
output=a+b;
return output;
}
float sub()
{
output=a-b;
return output;
}
float mul()
{
output=a*b;
return output;
}
float div()
{
output=a/b;
return output;
}
void displinfo()
{
printf("press 1 to perform Add press 2 to perform Sub press 3 to perform Mul press 4 to perform Div ");
scanf("%d",&value);
if(value==1)
{
add();
printf("output is: %0.2f",output);
}
else if(value==2)
{
sub();
printf("output is: %0.2f",output);
}
else if(value==3)
{
mul();
printf("output is: %0.2f",output);
}
else if(value==4)
{
div();
printf("output is: %0.2f",output);
}
else
{
printf("invalid value ");
}
}
displinfo();
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote