关于c语言的英文简介,C语言答案(国外英文资料).doc

C语言答案(国外英文资料)

C语言答案(国外英文资料)

Basic input/output functions

Write a basic function:

To assign values to six variables, the value of the variable is printed on the screen.

The variables are 10, -10, 40, 000, a, 3.14, and hello

# include < stdio, h >

Void main ()

{

Int b, c;

Long int d;

Char e, STR [5];

Float f;

Scanf (" % d, % d, % d, % c, % s, % s).

Printf (% d, % d, % c, % s, % f \ n, b, c, d, e, STR, f);

}

Basic data types and their operations

Write a program that requires the user to enter two integers a, b, to read the value that the user entered from the keyboard, and then print out the two Numbers

And the difference, the product, the quotient and the remainder and the average. The sum, difference, and remainder are output by integer, the product is output with long plastic, the quotient and the average are output by float.

Methods a

The main ()

{

Int x, y, he, cha, yu;

Long int ji;

Float sang, business;

Printf (" please input your two numbles! \ n ");

Scanf (% d, % d, &x, &y);

He = a + b;

Cha = a - b;

Yu = a % b;

So, ji equals (long int) a + b;

Sang a/b = 1.0 *;

Average = (a + b) / 2.0;

Printf (" \ nhe = % d, cha = % d, yu = % d), and "sang = % f", and "s = % f \ n", "he", "cha", "yu", "sang", "(")";

}

Method 2

# include < stdio, h >

Int plus (int q, int w)

{

Int plu;

Plu = q + w;

Return (plu);

}

Int cut (int a, int b)

{

Int cu;

Cu = a - b;

Return (cu);

}

Int thu (int r, int t)

{

Int th;

Th = r * t;

Return (th);

}

Float SAN (int u, int p)

{

Float sa;

Sa = u/p;

Return (sa);

}

The main ()

{

Int x, y, he, cha, ji;

Float sang;

Printf (" please input your two numbles! \ n ");

Scanf (% d, % d, &x, &y);

He = plus (x, y);

Cha = cut (x, y);

Ji = thu (x, y);

Sang = SAN (x, y);

Printf (" \ n he = % d, cha = % d, ji = % d, sang = % f \ n ", he, cha, ji, sang);

}

Program control structure - branch structure

Enter three integers, which are stored in the variable a, b, and c, and try to program the output of three variable values from big to small.

The main ()

{

Int x, y, z, t;

Scanf (% d %

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值