「C言語」intからdoubleへの型のキャストをするサンプル
サンプルコード
#include <stdio.h>
int main()
{
int sum = 17, count = 5;
double tt;
tt = (double) sum / count;
printf("Value of tt : %f\n", tt );
}
結果:
Value of tt : 3.400000
Coding Changes the World
サンプルコード
#include <stdio.h>
int main()
{
int sum = 17, count = 5;
double tt;
tt = (double) sum / count;
printf("Value of tt : %f\n", tt );
}
結果:
Value of tt : 3.400000