【2012四川省热身赛】Problem A. A - B Problem

来源:互联网 发布:js 字符串在数组中 编辑:程序博客网 时间:2024/05/13 11:00

Description

Calculate |a − b|

Input

The first line of input is a single number T(T ≤ 100),means the number of test cases.Then T cases
followed, each case contains only one line with two integers A and B(0 ≤ A;B ≤ 100).

Output

For each test case,you should output one line. First, output “Case #t: ”, t means the number of
the test case which is from 1 to T. Then, output an integer indicates the value of |a − b|.

Sample Input

21 63 2

Sample Output

Case #1: 5Case #2: 1

HINT

#include<stdio.h>
int main ()
{
 int a,b,c,i;
 scanf("%d\n",&a);
 for(i=0;i<a;i++)
 {
  scanf("%d %d",&b,&c);
  if(b>c)
  {
   printf("Case #%d: %d",i+1,b-c);
  }
  else
   printf("Case #%d: %d",i+1,c-b);
  printf("\n");
 }
 
}

原创粉丝点击