Regarding the program
While writing the following code for general arthematic operators, I ran the code with an error (which I later found & also marked below).
Surprisingly, without showing an error, the compiler gave an output, which is very odd and absurd.
FYI, I ran the code on repl.it. How did it even take the value of 'b'? On what basis it produced the outputs?
<span style="background-color: rgb(250, 250, 250);"> printf("Enter the value of 'a': ");</span>
printf("Enter the value of 'b': ");
scanf("%d",&a); -->Here, I had an error. Instead of 'b', I typed 'a'.
sum= a + b;
prod= a * b;
quo= (float) a/b;
rem= a % b;
printf("The sum of a & b is %.2f\n",sum);
printf("The difference of a & b is %.2f\n",diff);
printf("The product of a & b is %.2f\n",prod);
printf("The quotient when a is divided by b is %.2f\n",quo);
printf("The remainder when a is divided by b is %d\n",rem);
C-and-Cpp Arithmetic-Operators 06-07 min 40-50 sec
All memory addresses have some arbitrary values initialised (garbage value). If your program does not initialise values for that variable, the compiler uses the garbage value, and proceeds ahead with execution. Hope to clear your doubt.
Spoken Tutorial Group