fork download
  1. #include <stdio.h> // Header for Input/Output functions
  2.  
  3. int main() // Program execution starts here
  4. {
  5. // --- 1. YOUR PERSONAL DETAILS ---
  6. // This section prints your personal info as required
  7. printf("Name: Mohammad Masarwa\n");
  8. printf("Student ID: 01090613\n");
  9. printf("Degree Programme: Bsc Cybersecurity and Digital Forensics\n");
  10. // Using printf multiple times for a multi-line reason
  11. printf("Reason: I love the upcoming challenges that keep rising in this industry...\n");
  12. printf("...and how it has a lot of options everyday.\n");
  13.  
  14.  
  15. // --- 2. YOUR CALCULATIONS ---
  16. // Define digits from YOUR student ID (01090613)
  17. // We can pick non-zero digits like 1, 9, 6, 1, 3
  18. int d1 = 1;
  19. int d2 = 9;
  20. int d3 = 6;
  21. int d4 = 1;
  22. int d5 = 3;
  23.  
  24. // Perform the 4 required calculations
  25. int sum = d1 + d2 + d3 + d4 + d5; // Add them all
  26. int diff = d2 - d3; // Subtract two of them
  27. int prod = d2 * d3 * d5; // Multiply three of them
  28.  
  29. // For division, use 'float' to get decimal answers
  30. // Let's divide 9 by 3 (d2 / d5)
  31. float div = (float)d2 / (float)d5;
  32.  
  33.  
  34. // --- 3. DISPLAY RESULTS ---
  35. // Display the results of your calculations
  36. printf("\n--- Calculations based on my ID (01090613) ---\n");
  37. printf("Addition: %d + %d + %d + %d + %d = %d\n", d1, d2, d3, d4, d5, sum);
  38. printf("Subtraction: %d - %d = %d\n", d2, d3, diff);
  39. printf("Multiplication: %d * %d * %d = %d\n", d2, d3, d5, prod);
  40. printf("Division: %d / %d = %.2f\n", d2, d5, div); // %.2f formats to 2 decimal places
  41.  
  42.  
  43. return 0; // successfully ends the program
  44. }
Success #stdin #stdout 0s 5324KB
stdin
Standard input is empty
stdout
Name: Mohammad Masarwa
Student ID: 01090613
Degree Programme: Bsc Cybersecurity and Digital Forensics
Reason: I love the upcoming challenges that keep rising in this industry...
...and how it has a lot of options everyday.

--- Calculations based on my ID (01090613) ---
Addition: 1 + 9 + 6 + 1 + 3 = 20
Subtraction: 9 - 6 = 3
Multiplication: 9 * 6 * 3 = 162
Division: 9 / 3 = 3.00