运行结果:
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 ...
运行结果:
C语言代码:
/* c how to program 习题3.39 */
#include <stdio.h>
// function main begins program execution
int main( void )
{
//定义变量x为控制一行*的数量,y为控制*的行数
int x , y = 0;
//当行数 ...
运行结果:
C语言代码:
/* c how to program 习题3.38 */
#include <stdio.h>
// function main begins program execution
int main( void )
{
//定义变量 用户输入的数值number 临时数值temp 累加count
long int number, ...
运行结果:
C语言代码:
/* c how to program 习题3.37 */
#include <stdio.h>
// function main begins program execution
int main( void )
{
//定义变量 number
int number = 0;
//当number为1-100时执行循环
...
运行结果:
C语言代码:
/* c how to program 习题3.36 */
#include <stdio.h>
// function main begins program execution
int main( void )
{
//定义变量 number
long int number = 0;
//当number为1-1000000000时执 ...
运行结果:
C语言代码:
/* c how to program 习题3.35 */
#include <stdio.h>
// function main begins program execution
int main( void )
{
//定义变量 二进制数值binary 临时数值temp 每位的数值bit 基数factor 十进制数值 ...
运行结果:
C语言代码:
/* c how to program 习题3.34 */
#include <stdio.h>
// function main begins program execution
int main( void )
{
//定义变量
int number;
printf("请输入一个5位的整数:");
...
运行结果:
C语言代码:
/* c how to program 习题3.33 */
#include <stdio.h>
// function main begins program execution
int main( void )
{
//定义变量
int side, x, y;
//获取边长
printf("请输入正方形的边长1-20 ...
运行结果:
C语言代码:
/* c how to program 习题3.32 */
#include <stdio.h>
// function main begins program execution
int main( void )
{
//定义变量
int side, x, y;
//获取边长
printf("请输入正方形的边长 ...