Created
November 7, 2015 12:47
-
-
Save rahman541/08cefba19eb09f4f7666 to your computer and use it in GitHub Desktop.
Add and Minus between two integer, aritmetic operation determined by the user.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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