fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int a, b;
  5.  
  6. // Input two integers
  7. printf("Enter two integers: ");
  8. scanf("%d %d", &a, &b);
  9.  
  10. // Perform arithmetic operations
  11. int sum = a + b;
  12. int difference = a - b;
  13. int product = a * b;
  14.  
  15. // Display results in decimal, octal, and hexadecimal formats
  16. printf("%d %d %d\n", sum, difference, product); // Decimal
  17. printf("%o %o %o\n", sum, difference, product); // Octal
  18. printf("%X %X %X\n", sum, difference, product); // Hexadecimal
  19.  
  20. return 0;
  21. }
Success #stdin #stdout 0s 5280KB
stdin
12 5
stdout
Enter two integers: 17 7 60
21 7 74
11 7 3C