运行结果:
C语言代码:
/* c how to program 习题3.29 */
#include <stdio.h>
// function main begins program execution
int main( void )
{
//定义并初始化变量count为0
unsigned int count = 10;
//定义变量row
...
运行结果:
C语言代码:
/* c how to program 习题3.28 */
#include <stdio.h>
// function main begins program execution
int main( void )
{
//初始化变量count为0
int count = 0;
//当count少于10执行循环
whil ...
运行结果:
C语言代码:
/* c how to program 习题3.27 */
// Fig. 3.10: fig03_10.c
// Analysis of examination results
#include <stdio.h>
// function main begins program execution
int main( void )
{
// initialize var ...
运行结果:
C语言代码:
/* c how to program 习题3.26 */
#include <stdio.h>
#include <stdlib.h>
int main()
{
//分别定义变量
int counter = 0;
unsigned int number, largest=0, secondLargest=0;
//当coun ...
运行结果:
C语言代码:
/* c how to program 习题3.25 */
#include <stdio.h>
#include <stdlib.h>
int main()
{
//分别定义记数变量i和j
int i = 0, j;
//分别娄底列和行变量m和n
int m = 0, n;
//打印表 ...
运行结果:
C语言代码:
/* c how to program 习题3.24 */
#include <stdio.h>
#include <stdlib.h>
int main()
{
//分别定义变量
int i = 0, j;
int n;
//打印表格格式
printf("N\t10*N\t100*N\t1000*N\n\n ...
运行结果:
C语言代码:
/* c how to program 习题3.23 */
#include <stdio.h>
#include <stdlib.h>
int main()
{
//分别定义变量
int counter = 0;
int number = 0, largest=0;
//当counter++少于10,进入循环
...
运行结果:
C语言代码:
/* c how to program 习题3.22 */
#include <stdio.h>
#include <stdlib.h>
int main()
{
//分别定义变量
int number = 0;
while(number < 10){
printf("%d ", ++number);
...
运行结果:
C语言代码:
/* c how to program 习题3.21 */
#include <stdio.h>
#include <stdlib.h>
int main()
{
//分别定义变量
int number;
//获取number的值
printf("Enter a number: ");
scanf("%d", ...
运行结果:
C语言代码:
/* c how to program 习题3.20 */
#include <stdio.h>
#include <stdlib.h>
int main()
{
//分别定义变量
double houers, rate, salary;
//获取第一个员工的工作时间
printf("Enter num ...