3911 - a + b

通过次数

0

提交次数

0

时间限制 : 1 秒 内存限制 : 128 MB

    Your task is to calculate the sum of two nembers.

<br />

题目输入

    Input contains an integer N in the first line,and then n lines follows;Each line contains 
two nembers.

题目输出


    For each group of input nembers,you should output their sum with the accuracy of two decimal digits after the point in one line ,and you must notice that there is a blank between outputs;

输入/输出样例

输入格式

1
839.08 999.91

输出格式

1838.99

C语言解答

#include<stdio.h>
int main()
{
  int t;
  scanf("%d",&t);
  double a,b;
  while(t--)
 {
    scanf("%lf%lf",&a,&b);
    if(t==0)
      printf("%.2lf\n",a+b);
    else
      printf("%.2lf\n\n",a+b);
  }
  return 0;
}

C++解答

#include<stdio.h>
int main()
{
    int i,n;
    double a,b;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%lf%lf",&a,&b);
        printf("%.2f",a+b);
        printf("\n\n");
    }
    return 0;
}