BASIC CALCULATOR

Write a program that works as a simple calculator.

1.It reads a character (ch)
2.If ch is among β€˜+’, β€˜-’, β€˜*’, β€˜/’ or β€˜%’ it furthur takes two numbers (N1 and N2 as input). It then performs appropriate appropriate operation between numbers and print the number.
3.If ch is β€˜X’ or β€˜x’, the program terminates.
4.If ch is any other character, the program should print β€˜Invalid operation. Try again.’ and seek inputs again (starting from character).

PLEASE SEE MY CODE AND TELL ME ERROR

hello @dhruvk3k
a) u r not reading ch , in while loop condition it should be && in place of ||
image

b)
image

reading operands without validating the operator. what if given ch is invalid.

c)

image

here in place of if there should be else if otherwise ur code will always print invalid operation if u input ch other than %

d) u need to print all the outputs in newline

runguard: warning: timelimit exceeded (wall time): aborting command
runguard: warning: command terminated with signal 15
yeh error araha hai

pls share ur updated code . i will check

check now->