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.  
  6. #include <stdio.h>
  7.  
  8. int main ()
  9. {
  10. /* variable definition: */
  11. float base, sidea, sideb, perimeter;
  12.  
  13. /* Prompt user for base */
  14. printf("Enter the base of the triangle: \n");
  15.  
  16. // Input the base
  17. scanf("%f", &base);
  18.  
  19. /* Prompt user for sidea */
  20. printf("Enter the side A of the triangle: \n");
  21.  
  22. // Input the sidea
  23. scanf("%f", &sidea);
  24.  
  25. /* Prompt user for sideb */
  26. printf("Enter the side B of the triangle: \n");
  27.  
  28. // Input the sideb
  29. scanf(%f”, &sideb);
  30.  
  31. // Calculate the Perimeter
  32. Perimeter= (base + sidea + sideb);
  33.  
  34. // Print the result
  35. printf(“Perimeter is : %f\n", perimeter );
  36.  
  37. return 0;
  38. }
  39.  
  40.  
  41.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
5
10
5
compilation info
prog.c: In function ‘main’:
prog.c:29:9: error: stray ‘\342’ in program
   scanf(“%f”, &sideb);
         ^
prog.c:29:10: error: stray ‘\200’ in program
   scanf(“%f”, &sideb);
          ^
prog.c:29:11: error: stray ‘\234’ in program
   scanf(“%f”, &sideb);
           ^
prog.c:29:12: error: expected expression before ‘%’ token
   scanf(“%f”, &sideb);
            ^
prog.c:29:14: error: stray ‘\342’ in program
   scanf(“%f”, &sideb);
              ^
prog.c:29:15: error: stray ‘\200’ in program
   scanf(“%f”, &sideb);
               ^
prog.c:29:16: error: stray ‘\235’ in program
   scanf(“%f”, &sideb);
                ^
prog.c:32:3: error: ‘Perimeter’ undeclared (first use in this function)
   Perimeter= (base + sidea + sideb);
   ^~~~~~~~~
prog.c:32:3: note: each undeclared identifier is reported only once for each function it appears in
prog.c:35:10: error: stray ‘\342’ in program
   printf(“Perimeter is : %f\n", perimeter );
          ^
prog.c:35:11: error: stray ‘\200’ in program
   printf(“Perimeter is : %f\n", perimeter );
           ^
prog.c:35:12: error: stray ‘\234’ in program
   printf(“Perimeter is : %f\n", perimeter );
            ^
prog.c:35:23: error: expected ‘)’ before ‘is’
   printf(“Perimeter is : %f\n", perimeter );
                       ^~
prog.c:35:30: error: stray ‘\’ in program
   printf(“Perimeter is : %f\n", perimeter );
                              ^
prog.c:35:32: warning: missing terminating " character
   printf(“Perimeter is : %f\n", perimeter );
                                ^
prog.c:35:32: error: missing terminating " character
   printf(“Perimeter is : %f\n", perimeter );
                                ^~~~~~~~~~~~~~~
prog.c:38:1: error: expected ‘;’ before ‘}’ token
 }
 ^
prog.c:11:29: warning: unused variable ‘perimeter’ [-Wunused-variable]
   float base, sidea, sideb, perimeter;
                             ^~~~~~~~~
stdout
Standard output is empty