简单的C语言

[复制链接]
查看11 | 回复5 | 2010-12-10 14:17:44 | 显示全部楼层 |阅读模式
Description:
每读入两个整数,输出其差。
Input:
输入数据含有不超过50个的整数对,每个整数和每对整数的运算结果都不会超过±2^31。
Output:
对于每次读入的一对整数,输出前者减去后者的差。每个结果应以回车结束。
Sample Input:
1 3 5 7Sample Output:
-2
-2
Source:
qianneng

回复

使用道具 举报

千问 | 2010-12-10 14:17:44 | 显示全部楼层
1.#include int gcd( int a, int b ){ int rem; while ( b ) { rem = a % b; a = b; b = rem; } return rem;}int main( ){ int a, b; scanf("%d%d", &a, &b); printf("%d\n", gcd( a, b )); return 0;}2.#include int gcd( int a, int b ){ int rem; while ( b
回复

使用道具 举报

千问 | 2010-12-10 14:17:44 | 显示全部楼层
1.#include int gcd( int a, int b ){ int rem; while ( b ) { rem = a % b; a = b; b = rem; } return rem;}int main( ){ int a, b; sc
回复

使用道具 举报

千问 | 2010-12-10 14:17:44 | 显示全部楼层
#include int main(void){
long int a,b;
while (scanf("%ld%ld",&a,&b)!=EOF)
printf("%ld\n",a-b);
return 0;}
回复

使用道具 举报

千问 | 2010-12-10 14:17:44 | 显示全部楼层
#includeint main(){ __int64 m,n; while(scanf("%lld%lld",&m,&n))printf("%lld\n",m-n); return 0;}
回复

使用道具 举报

千问 | 2010-12-10 14:17:44 | 显示全部楼层
这个上学的时候学过,看到你的这个之后就愣是没有想起来的
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行