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

what is the erro of this program #include int calc(int base, int hight); void re

ID: 3581911 • Letter: W

Question

what is the erro of this program #include int calc(int base, int hight); void read(int *base, int *hight); int main() { int base; int hight; read(&base, &hight); printf(" %d", calc(base, hight)); return 0; } void read(int *base, int *hight) { printf("please enter bas: "); scanf_s("%d", &base); printf("please enter hight: "); scanf_s("%d", &hight); } int clac(int base, int hight) { return (base * hight / 2); } #include int calc(int base, int hight); void read(int *base, int *hight); int main() { int base; int hight; read(&base, &hight); printf(" %d", calc(base, hight)); return 0; } void read(int *base, int *hight) { printf("please enter bas: "); scanf_s("%d", &base); printf("please enter hight: "); scanf_s("%d", &hight); } int clac(int base, int hight) { return (base * hight / 2); }

Explanation / Answer

// c code

#include <stdio.h>
#include <stdlib.h>

int calc(int base, int hight);
void read(int *base, int *hight);

int main()
{
   int base;
   int hight;

   read(&base, &hight);
   printf(" %d ", calc(base, hight));

   return 0;
}

void read(int *base, int *hight)
{
   // scanf should receiver *base not base
   printf("please enter bas: ");
   scanf("%d", &*base);

   // scanf should receiver *hight not hight
   printf("please enter hight: ");
   scanf("%d", &*hight);
}

int calc(int base, int hight)
{
   return (base * hight / 2);
}

/*
output:

please enter bas: 3
please enter hight: 4
6


*/