运行结果:
C语言代码:
/* c how to program 习题4.12
** 计算2-30的偶数和 */
#include <stdio.h>
#include <math.h>
// function main begins program execution
int main( void )
{
//定义变量number为偶数,total为累加 ...
运行结果:
C语言代码:
/* c how to program 习题4.11 */
#include <stdio.h>
#include <math.h>
// function main begins program execution
int main( void )
{
//定义变量value为输入的整数,number为整数的个数,count为 ...
运行结果:
C语言代码:
/* c how to program 习题4.10
** 计算平均值 */
#include <stdio.h>
#include <math.h>
// function main begins program execution
int main( void )
{
//定义变量number为获取的整数,count为循环 ...
运行结果:
C语言代码:
/* c how to program 习题4.9 */
/*计算整数的和*/
#include <stdio.h>
#include <math.h>
// function main begins program execution
int main( void )
{
//定义变量number为整数的个数,count为累 ...
a) 运行结果:
a) C语言代码:
/* c how to program 习题3.45 */
#include <stdio.h>
// function main begins program execution
int main( void )
{
//分别定义变量
int number = -1, temp = 1, count = 1;
//获取num ...
运行结果:
C语言代码:
/* c how to program 习题3.44 */
#include <stdio.h>
// function main begins program execution
int main( void )
{
//分别定义三条边长变量a,b,c
int a, b, c;
printf("请分别请入三条边a b ...
运行结果:
C语言代码:
/* c how to program 习题3.43 */
#include <stdio.h>
// function main begins program execution
int main( void )
{
//分别定义三条边长变量a,b,c
int a, b, c;
printf("请分别请入三条边a b ...
运行结果:
C语言结果:
/* c how to program 习题3.42 */
#include <stdio.h>
// function main begins program execution
int main( void )
{
//分别定义变量x,y
int x, y;
printf("请分别请入x y的值:");
scanf ...
运行结果:
C语言代码:
/* c how to program 习题3.41 */
#include <stdio.h>
// function main begins program execution
int main( void )
{
//分别定义变量半径,直径,周长,面积
float radius, pi = 3.14159;
// ...
运行结果:
C语言代码:
/* c how to program 习题3.40 */
#include <stdio.h>
// function main begins program execution
int main( void )
{
//定议变量number
int number = 1;
//当number不等于0执行循环
while ...