I want to convert energy from joules(J) to gigajoules(GJ)
1 joules = 0.000000001 GJ
and i use this--->
printf("\nEnter the value of length to be converted: ");
scanf("%f",&value);
printf("\nEnter the unit of value entered (J/kJ/MJ/GJ/cal) : ");
scanf("%s",&unit1);
printf("\nEnter the unit to convert value to(J/kJ/MJ/GJ/cal) : ");
scanf("%s",&unit2);
if((strcmp("J",unit1) == 0)&&(strcmp("GJ",unit2)==0))
ans=(value/(float)1000000000);
printf("\n%f %s is equal to %f %s\n",value,unit1,ans,unit2);
when I try to print the "ans", it turns out to be like this-->
1.000000 J is equal to 0.000000 GJ
what I want is-->
1.000000 J is equal to 0.000000001 GJ
Please help me T_T Or u can suggest to me a good idea