[Solved] How to write a program, that reads 2 float numbers using scanf() with sum, difference, product, division and average?


Your scanf_s() function is trying to read an integer in base 10 and store it into a float variable. Therefore when you try to enter 3.14 for the first number, scanf_s() will stop at the “.” character (but leave it in the input stream). When you try to read the second decimal integer, it will enter an infinite loop waiting for a character it can consume.

Short answer: Change the %d in scanf_s() to %f.

solved How to write a program, that reads 2 float numbers using scanf() with sum, difference, product, division and average?