I'm trying to run some basic code in C to declare 2 float variables, and then divide them and put that value in the 3rd variable. After this I print all 3.
#include <stdio.h>
int main ()
{
/* variable definition: */
float a, b, c;
/* variable initialization */
a = 1.2;
b = 2.7;
c = a / b;
printf("Floats (a,b) and quotient (c) are : %d,%d,%d \n", a,b,c);
return 0;
}
I'm using the online compiler "www.ideone.com" to compile and run the code, and this is the result I'm getting:
Success time: 0 memory: 2156 signal:0
Floats (a,b) and quotient (c) are : 1073741824,1072902963,-1610612736
Can anyone see if perhaps I made a mistake in the code? It's for a class and everything worked fine for every step of directions until I changed from int to float.