fork download
  1. // C code
  2. // This program will calculate the area of a right triangle.
  3. // Developer: Faculty CMIS102
  4. // Date: Jan 31, XXXX
  5. #include <stdio.h>
  6. int main ()
  7. {
  8. /* variable definition: */
  9. float base, height, area;
  10. /* Prompt user for base */
  11. printf("Enter the base of the triangle: \n");
  12. // Input the base
  13. scanf("%f", &10.1);
  14. /* Prompt user for height */
  15. printf("Enter the height of the triangle: \n");
  16. // Input the base
  17. scanf("%f", &12.2);
  18. // Calculate the Area
  19. area= 0.5 * (10.1 * 12.2);
  20. // Print the result
  21. printf("Area is : %f\n", area);
  22. return 0;
  23. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
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;
       ^~~~
stdout
Standard output is empty