Skip to content

Instantly share code, notes, and snippets.

@rahman541
Created November 7, 2015 12:47
Show Gist options
  • Save rahman541/08cefba19eb09f4f7666 to your computer and use it in GitHub Desktop.
Save rahman541/08cefba19eb09f4f7666 to your computer and use it in GitHub Desktop.
Add and Minus between two integer, aritmetic operation determined by the user.
#include <stdio.h>
int main( )
{
char op;
int num1, num2, sum;
printf("Enter 1st integers: ");
scanf("%d",&num1);
printf("Enter 2nd integers: ");
scanf("%d",&num2);
printf("Enter Arithmetic Operation (- / +): ");
scanf(" %c",&op);
if(op == '-'){
printf("== Minus ==");
sum=num1-num2;
}else if(op == '+'){
printf("== Plus ==");
sum=num1+num2;
}
printf("\nSum: %d",sum); /* Displays sum */
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment