+2

I know im missing something just dont know what

Hi. Im trying to program a very simple calculator program where you input 2 int values and a char (either a or s). Im trying to get it so if you type a the values will be added together af you type s the values will be subtracted. Ive been scratching my head on this one for a bit wondered if anyone had any idea what im doing wrong? Thanks. https://code.sololearn.com/cX79Ej1k2vUx

c

10/21/2019 9:02:25 PM

Cameron Duncan

4 Answers

New Answer

+5

Cameron Duncan What is this ? x = scanf("%d\n"); y = scanf("%d\n"); basic syntax error it should be scanf("%d", &x); scanf("%d", &y); And at Sololearn you need to enter input like on separate lines 2 (1st num) 3 (2nd num) a (operation) (submit)

+2

Cameron Duncan Syntax Error at line 16,17. Write like this- scanf("%d",&x); scanf("%d",&y);

+2

Yes! that worked. Thank you guys for the help. Will make sure to keep that syntax in mind for future. Cheers

0

cool thanks guys will change it up give it ago. ~swim~ yeh i know was doing that for input and still no output. Will try this se what happens