fork(1) download
  1. #include <stdio.h>
  2.  
  3. int main ()
  4. { /* variable definition: */
  5. float base, height, perimeter;
  6. /* Prompt user for base */
  7. printf("Enter the base of the triangle: \n");
  8. // Input the base
  9. scanf("%f", &3);
  10. /* Prompt user for height */
  11. printf("Enter the height of the triangle: \n");
  12. // Input the base
  13. scanf("%f", &2);
  14. // Calculate the Perimeter
  15. perimeter = base + height + sqrt(base * base + height * height);
  16. // Print the result
  17. printf("Perimeter of right angled triangle is: %.3f", perimeter);
  18.  
  19. return 0;
  20. }
  21.  
  22.  
  23.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:9:13: error: cannot take the address of an rvalue of type 'int'
scanf("%f", &3); 
            ^~
prog.c:13:13: error: cannot take the address of an rvalue of type 'int'
scanf("%f", &2); 
            ^~
prog.c:15:30: warning: implicitly declaring library function 'sqrt' with type 'double (double)' [-Wimplicit-function-declaration]
 perimeter = base + height + sqrt(base * base + height * height);
                             ^
prog.c:15:30: note: include the header <math.h> or explicitly provide a declaration for 'sqrt'
1 warning and 2 errors generated.
stdout
Standard output is empty