fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int quantity;
  5. float price, total;
  6.  
  7. // Input quantity
  8. printf("Enter quantity: ");
  9. scanf("%d", &quantity);
  10.  
  11. // Input price per item
  12. printf("Enter price per item: ");
  13. scanf("%f", &price);
  14.  
  15. // Calculate total
  16. total = quantity * price;
  17.  
  18. // Output total
  19. printf("Total price = %.2f\n", total);
  20.  
  21. return 0;
  22. }
Success #stdin #stdout 0.04s 25588KB
stdin
Standard input is empty
stdout
#include <stdio.h>

int main() {
    int quantity;
    float price, total;

    // Input quantity
    printf("Enter quantity: ");
    scanf("%d", &quantity);

    // Input price per item
    printf("Enter price per item: ");
    scanf("%f", &price);

    // Calculate total
    total = quantity * price;

    // Output total
    printf("Total price = %.2f\n", total);

    return 0;
}