私はコンピュータプログラミングの初心者です。私はプログラムを書いています。何らかの理由で、何らかの演算の浮動小数点値を計算しようとすると、0.00000という結果になります。誰かが私を助けてくれれば大いに感謝します!私は浮動小数点の助けが必要です
#include <stdio.h>
int main(void)
{
int numa, numb;
int sum, halffirst, halfsecond, quotient, remainder;
// get input
printf("\nPlease enter two integers: ");
scanf("%d%d", &numa, &numb);
// calculate dimensions
sum = numa + numb;
halffirst = (double)numa/2.0;
halfsecond = numb/2;
quotient = numa/numb;
remainder = numa % numb;
// display report
printf("\n%20s%20s", "Description", "Data");
printf("\n%20s%20s", "-----------", "----");
printf("\n%20s%20d", "Sum", sum);
printf("\n%20s%20lf", "Half (1st #)", halffirst);
printf("\n%20s%20d", "Half (2nd #)", halfsecond);
printf("\n%20s%20lf", "Quotient", quotient);
printf("\n%20s%20d", "Remainder", remainder);
// format and finish
printf("\n\n");
return 0;
}
ありがとうございます。どうすればよいですか?私は非常に新しい申し訳ありません... :( –