Question: Programming in C | Instead of repeating the same code five times modify the code to use a FOR loop to ask for 5 user
Programming in C | Instead of repeating the same code five times modify the code to use a FOR loop to ask for 5 user inputs.
Use an input statement such as scanf(%c, &ch); to replace the assignment statements such as ch = '+';
Warning remember you can leave a character in the input buffer. You might need to sanitize your inputs. The scanf command as given will read only one character.

#include void main () char ch; int f, a = 10, b= 20; printf ( "ch- %c " , ch) ; switch (ch) case 't': f- a + b; printf("f- %d ", case '-': f = a -b; printf("f = %d ", case ' *': f- a * b; printf ("f- %d ", case '/': f a / b; printf ("f- %d ", default: printf ("invalid operator ") f); f); f); f); a-10, b 20; printf ( "ch- %c ", switch (ch) ch); case " +": f a + b; printf ("f- %d ", case '-': f a - b; printf("f- %d ", case '*': f a * b; printf("f- %d ", case '/': f-a / b; printf("f- %d ", default: printf ("invalid operatorln"); f); f); f); f); a-10, b20; printf ("chcIn", ch) switch (ch) ( case '+': f a + b; printf("f- %d ", case '-': f a - b; printf("f- %d ", case ' *': f - a * b; printf ("f- %d ", case '/': f = a / b; printf("f-%d ", default: printf ("invalid operator ") f); f); f); f); a10, b20; printf ( "ch- %c ", switch (ch) ch) ; case 't': f a + b; printf("f %d ", case '-': f = a - b; printf("f %d ", case ' *': f a * b; printf ("f- %d ", case '/': f a / b; printf("f- %d ", default: printf ("invalid operator ") f); f); f); f); ch' a = 10, b= 20; printf ( "ch- %c ", switch (ch) ch) ; case 't': f a + b; printf("f- %d ", case '-': f a -b; printf ("f- %d ", case ' *': f a * b; printf(" f %d ", case '/': f - a / b; printf("f- %d ", default: printf ("invalid operator n" f); f); f); f)