There was a left over.
This commit is contained in:
10
programs/abs-floating/info.json
Normal file
10
programs/abs-floating/info.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"language": "C",
|
||||
"name": "演習課題2 浮動小数点数版",
|
||||
"description": "倍精度浮動小数点数を読み込み、その絶対値を出力するプログラム。",
|
||||
"output": {
|
||||
"type": "screenshot",
|
||||
"content": "./assets/abs-floating.png"
|
||||
},
|
||||
"note": ""
|
||||
}
|
||||
BIN
programs/abs-floating/main
Executable file
BIN
programs/abs-floating/main
Executable file
Binary file not shown.
17
programs/abs-floating/main.c
Normal file
17
programs/abs-floating/main.c
Normal file
@@ -0,0 +1,17 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
double x, y;
|
||||
|
||||
printf("Input floating point: ");
|
||||
scanf("%lf", &x);
|
||||
|
||||
y = x;
|
||||
|
||||
if (y < 0.0)
|
||||
y = -y;
|
||||
|
||||
printf("Absolute value of %lf is %lf.\n", x, y);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user