Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main(){
- int a;
- char symbol;
- int b;
- int c = a + b;
- printf("Enter digit\n");
- while(scanf("%d",&a) != 1)
- {
- printf("Please enter an integer: ");
- while(getchar() != '\n');
- }
- //scanf(" %d", &a);
- printf("Enter + symbol\n");
- fflush(stdin);
- scanf(" %c", &symbol);
- printf("Enter digit\n");
- // scanf(" %d", &b);
- while(scanf("%d",&b) != 1)
- {
- printf("Please enter an integer: ");
- while(getchar() != '\n');
- }
- if(symbol == '+'){
- int sum;
- sum = a + b;
- printf(" %d\n\n", sum);
- }
- printf("---------------------------------\n");
- printf("---------------------------------\n");
- printf("\n");
- printf("a: %d b: %d c: %c\n", a,b,symbol);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement