Last active
August 18, 2020 05:19
-
-
Save FlowingSPDG/3a743c196924d07c70db49fabbde584e to your computer and use it in GitHub Desktop.
正の実数の和を小数点一桁まで出力するプログラム(C)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "stdio.h" | |
| int main(void){ | |
| float a = 0.00; | |
| float b = 0.00; | |
| printf("Input varialbe A and B : "); | |
| if ( scanf("%f,%f",&a,&b) != 2 ) { | |
| printf("Failed to scan...\n"); | |
| return -1; | |
| } | |
| // printf("input A : %f \n",a); | |
| // printf("input B : %f \n",b); | |
| // printf("OUTPUT : %.1f \n",a+b); | |
| printf("%.1f \n",a+b); | |
| // 切り上げ、切り捨てや四捨五入などは指定されなかったので考えていない | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment