// C code
// This program will calculate the area of a right triangle.
// Developer: Faculty CMIS102
// Date: Jan 31, XXXX
#include <stdio.h>
int main ()
{
/* variable definition: */
float base, height, area;
/* Prompt user for base */
printf("Enter the base of the triangle: \n"); // Input the base
/* Prompt user for height */
printf("Enter the height of the triangle: \n"); // Input the base
// Calculate the Area
area= 0.5 * (10.1 * 12.2);
// Print the result
printf("Area is : %f\n", area
); return 0;
}
Ly8gQyBjb2RlCi8vIFRoaXMgcHJvZ3JhbSB3aWxsIGNhbGN1bGF0ZSB0aGUgYXJlYSBvZiBhIHJpZ2h0IHRyaWFuZ2xlLgovLyBEZXZlbG9wZXI6IEZhY3VsdHkgQ01JUzEwMgovLyBEYXRlOiBKYW4gMzEsIFhYWFgKI2luY2x1ZGUgPHN0ZGlvLmg+CmludCBtYWluICgpCnsKLyogdmFyaWFibGUgZGVmaW5pdGlvbjogKi8KZmxvYXQgYmFzZSwgaGVpZ2h0LCBhcmVhOwovKiBQcm9tcHQgdXNlciBmb3IgYmFzZSAqLwpwcmludGYoIkVudGVyIHRoZSBiYXNlIG9mIHRoZSB0cmlhbmdsZTogXG4iKTsKLy8gSW5wdXQgdGhlIGJhc2UKc2NhbmYoIiVmIiwgJjEwLjEpOwovKiBQcm9tcHQgdXNlciBmb3IgaGVpZ2h0ICovCnByaW50ZigiRW50ZXIgdGhlIGhlaWdodCBvZiB0aGUgdHJpYW5nbGU6IFxuIik7Ci8vIElucHV0IHRoZSBiYXNlCnNjYW5mKCIlZiIsICYxMi4yKTsKLy8gQ2FsY3VsYXRlIHRoZSBBcmVhCmFyZWE9IDAuNSAqICgxMC4xICogMTIuMik7Ci8vIFByaW50IHRoZSByZXN1bHQKcHJpbnRmKCJBcmVhIGlzIDogJWZcbiIsIGFyZWEpOwpyZXR1cm4gMDsKfQ==
prog.c: In function ‘main’:
prog.c:13:13: error: lvalue required as unary ‘&’ operand
scanf("%f", &10.1);
^
prog.c:17:13: error: lvalue required as unary ‘&’ operand
scanf("%f", &12.2);
^
prog.c:9:13: warning: unused variable ‘height’ [-Wunused-variable]
float base, height, area;
^~~~~~
prog.c:9:7: warning: unused variable ‘base’ [-Wunused-variable]
float base, height, area;
^~~~