【问题描述】

现在有两个实数,分别是A和B。请你从文件中读取A和B,计算它们的和A+B,并把它输出到文件中。(保留到整数)

【输入格式】

第一行:一个实数A
第二行:一个实数B

【输出格式】

第一行:一个整数C = A+B

【输入样例】

1
2

【输出样例】

3

        解题思路:此题简单题,但是注意输入的是两个实数,输出为整数,因此需要保证像1.4+2.6=4 而不是3。
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
 float a,b;
 freopen("aplusb.in","r",stdin);
 freopen("aplusb.out","w",stdout);
 scanf("%f%f",&a,&b);
 printf("%.0f",a+b);
 //system("PAUSE");
 return 0;
}


相关文章:

  • 2021-06-28
  • 2021-04-19
  • 2022-12-23
  • 2022-01-20
  • 2021-11-13
  • 2021-06-01
  • 2021-04-26
  • 2021-05-24
猜你喜欢
  • 2021-07-17
  • 2022-12-23
  • 2021-08-27
  • 2022-12-23
  • 2021-12-27
  • 2021-11-23
  • 2022-12-23
相关资源
相似解决方案