fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. float width, length, area;
  5. char choice;
  6.  
  7. do {
  8. printf("Please enter the width of the rectangle: ");
  9. scanf("%f", &width);
  10. printf("Please enter the length of the rectangle: ");
  11. scanf("%f", &length);
  12.  
  13. // Calculate the area
  14. area = width * length;
  15.  
  16. printf("The area of the rectangle is: %.2f\n", area);
  17.  
  18. // Ask the user if they want to continue
  19. printf("Do you want to calculate another area? (y/n): ");
  20. scanf(" %c", &choice);
  21.  
  22. } while (choice == 'y' || choice == 'Y');
  23.  
  24. printf("Thank you for using the program!\n");
  25.  
  26. return 0;
  27. }
  28.  
Success #stdin #stdout 0.01s 5272KB
stdin
Standard input is empty
stdout
Please enter the width of the rectangle: Please enter the length of the rectangle: The area of the rectangle is: 0.00
Do you want to calculate another area? (y/n): Thank you for using the program!