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
*/
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.