Program for Arithmetic Operations

Algorithm

Step 1: Start

Step 2: Declare three integer variables a, b, c

Step 3: Take input for a and b

Step 4: Compute sum, difference, product, division, and remainder

Step 5: Print the results

Step 6: End

Flowchart

graph TD; A([Start]) --> B[Declare int a, b, c]; B --> C[/Input a, b/]; C --> D[Compute sum]; D --> E[/Print Sum/]; E --> F[Compute difference]; F --> G[/Print difference/]; G --> H[Compute product]; H --> I[/Print Product/]; I --> J[Compute division]; J --> K[/Print division/]; K --> L[Compute remainder]; L --> M[/Print remainder/]; M --> N([End]); classDef start fill:#00cc44,stroke:#006622,stroke-width:2px,color:#ffffff; classDef stop fill:#ff4444,stroke:#cc0000,stroke-width:2px,color:#ffffff; classDef input_output fill:#ffdd44,stroke:#cc9900,stroke-width:2px,color:#000000; classDef process fill:#4488ff,stroke:#0044cc,stroke-width:2px,color:#ffffff; class A start; class F,N stop; class C,E,G,I,K,M input_output; class B,D,F,J,L,H process;

Program

#include<stdio.h>

int main() {
    int a, b, c;
    printf("Enter First Number: ");
    scanf("%d", &a);
    printf("Enter Second Number: ");
    scanf("%d", &b);

    // Sum
    c = a + b;
    printf("\nSum of %d and %d is %d", a, b, c);

    // Difference
    c = a - b;
    printf("\nDifference of %d and %d is %d", a, b, c);

    // Product
    c = a * b;
    printf("\nProduct of %d and %d is %d", a, b, c);

    // Division
    c = a / b;
    printf("\nDivision of %d and %d is %d", a, b, c);

    // Remainder
    c = a % b;
    printf("\nReminder of %d and %d is %d", a, b, c);

    return 0;
}
            

Test Case Output
Enter First Number:  10
Enter Second Number:  3

Sum of 10 and 3 is 13
Difference of 10 and 3 is 7
Product of 10 and 3 is 30
Division of 10 and 3 is 3
Reminder of 10 and 3 is 1