fork download
  1. #include <stdio.h>
  2. int main() {
  3. int num1, num2, num3;
  4. int sum, difference, product, remainder;
  5. float average;
  6.  
  7. // Prompt the user to input three integers
  8. printf("Enter the first integer: ");
  9. scanf("%d", &num1);
  10.  
  11. printf("Enter the second integer: ");
  12. scanf("%d", &num2);
  13.  
  14. printf("Enter the third integer: ");
  15. scanf("%d", &num3);
  16.  
  17. // Perform calculations
  18. sum = num1 + num2 + num3;
  19. average = sum / 3.0; // Use 3.0 for float division
  20. difference = num1 - num3;
  21. product = num1 * num2 * num3;
  22. remainder = num1 % num2;
  23.  
  24. // Display results
  25. printf("\nResults:\n");
  26. printf("Sum: %d\n", sum);
  27. printf("Average: %.2f\n", average);
  28. printf("Difference (first - last): %d\n", difference);
  29. printf("Product: %d\n", product);
  30. printf("Remainder (first %% second): %d\n", remainder);
  31.  
  32. return 0;
  33. }
Success #stdin #stdout 0s 5276KB
stdin
Standard input is empty
stdout
Enter the first integer: Enter the second integer: Enter the third integer: 
Results:
Sum: 702780809
Average: 234260272.00
Difference (first - last): 16585
Product: -1305642496
Remainder (first % second): 21913