Subtract two numbers without using subtraction (-) Operator

 #include <stdio.h>


int main() {
    int num1, num2, result;

    printf("Enter the first number: ");
    scanf("%d", &num1);

    printf("Enter the second number: ");
    scanf("%d", &num2);

    // Subtract num2 from num1 without using the '-' operator
    result = num1 + (-num2);

    printf("The result of %d - %d is %d\n", num1, num2, result);

    return 0;
}

Comments

Popular posts from this blog

History of Computer

Introduction to Computer

Computer Generation