我是编程世界的新手,我现在仍然坚持看似简单的问题 . 我试图输入一个整数,并希望输出是一个浮点数 . 我的代码总是导致输出为0.0000 . 我怎样才能解决这个问题?我试着实现像Square of 6这样的输出是2.0非常感谢你的帮助 .
#include <stdio.h>
float Divide (float value);
int main ()
{
/* variable definition: */
int floatValue, menuSelect, Results;
floatValue = 1;
{
printf ("Enter a Integer\n: ");
scanf ("%f", &floatValue);
if (floatValue > 0)
{
// Call the Quotient Function
Results = Divide (floatValue);
printf ("Quotient of %d is %f\n", floatValue, Results);
}
}
return 0;
}
/* function returning the quotient of a number */
float Divide (float value)
{
return value / 3;
}