Skip to content

Instantly share code, notes, and snippets.

@KeitetsuWorks
Last active June 10, 2017 10:54
Show Gist options
  • Save KeitetsuWorks/6926102095fe44795c58a5ed24428a3f to your computer and use it in GitHub Desktop.
Save KeitetsuWorks/6926102095fe44795c58a5ed24428a3f to your computer and use it in GitHub Desktop.
q14175234339
#include <stdio.h>
int main(void)
{
int v; // 計算対象値は整数型と浮動小数点型
float w;
float wa,seki; // 計算結果は浮動小数点型変数に格納
v = 10; // 計算対象値を代入
w = 25.5;
wa = v + w; // 浮動小数点型に型変換されて格納される
seki = v * w;
printf("v: %d, w: %f\n", v, w);
printf("計算結果\n");
printf("v + w: %5.1f, v * w: %5.1f\n", wa, seki);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment