<strong><span style="font-size:18px;">/*
循环结构,课上.
*/
#include <stdio.h>
int main()
{
// int count = 7;
// int i = 1;
// double tempreature;
// double tempsum;
// double tempave;
// while (i<=count) {
// printf("请输入第%d天得温度",i);
// scanf("%lf",&tempreature);
// tempsum += tempreature;
// i++;
// }
//
// tempave = tempsum / count;
// printf("平均温度为%g\n",tempave);
// 考虑一下count的值 0 作为标识符,不参与运算.求平均值时候注意下!
// double countnum;
// int count = 1;
// double sum;
// double avg;
// while (countnum != 0) {
// printf("请输入第%d个数字,0为停止输入!\n",count);
// scanf("%lf",&countnum);
// sum += countnum;
// count++;
// }
// avg = sum / (count - 2);
// if (count == 2) {
// printf("您没有输入有效的数值.\n");
// }else
// printf("这%d个数字的和为%g.\n平均值为%g\n",count-2,sum,avg);
// int passwords = 999999;
// int input;
// int ci = 1;
// do {
// printf("请输入密码:\n");
// scanf("%d",&input);
// if (passwords == input) {
// printf("恭喜您,登陆成功.\n");
// break;
// }
// ci++;
// } while (ci <= 3);
// if (ci>3) {
// printf("您输入的次数已尽.\n");
//
// }
//
//
//
// int i = 1;
// do {
// if (i%7 == 0) {
// printf("%d\n",i);
// }
// i++;
// } while (i<=100);
//
//
// int passwords = 888888;
// int input;
// int ci = 1;
// while (ci<=3) {
// printf("第%d次输入密码:\n",ci);
// scanf("%d",&input);
// if (passwords == input) {
// printf("登陆成功\n");
// break;
// }
// ci++;
//
// }
// if (ci > 3) {
// printf("输入次数已尽\n");
// }
//
//
// 张张张张张张张张张
// 宋张张张张张张张宋
// 宋宋张张张张张宋宋
// 宋宋宋张张张宋宋宋
// 宋宋宋宋张宋宋宋宋
// 爽爽爽爽杰爽爽爽爽
// 爽爽爽杰杰杰爽爽爽
// 爽爽杰杰杰杰杰爽爽
// 爽杰杰杰杰杰杰杰爽
// 杰杰杰杰杰杰杰杰杰
//
//
// int i,j;
// int x,y;
// printf("\n\n\n\n\n\n\n");
// for (i = 0; i<5; i++) {
//
// for (j = 0; j < 2*i-i; j++) {
// printf("宋");
// }
//
// for (j = 0; j<2*5-2*i-1; j++) {
// printf("张");
// }
// for (j = 0; j < 2*i-i; j++) {
// printf("宋");
// }
//
//
// printf("\n");
// }
//
//
// for (x = 0; x<5; x++) {
//
// for (y = 0; y < 5-x-1; y++) {
// printf("爽");
// }
// for (y = 0; y<2*x+1; y++) {
// printf("杰");
// }
// for (y = 0; y < 5-x-1; y++) {
// printf("爽");
// }
// printf("\n");
// }
//
// printf("\n\n\n\n\n\n\n");
// 练习page91 第五章练习.循环结构.编程题.
//
// 1.
// int k,h;
// for (k = 0; k < 5; k++) {
// for (h = 0; h < 5 - k; h++) {
// printf("*");
// }
//
//
// printf("\n");
// }
// 2.
// int i,j;
// for (i = 0; i < 5; i++) {
// for (j = 0; j < 2*i-i; j++) {
// printf(" ");
// }
// for (j = 0; j < 5*2-2*i-1; j++) {
// printf("*");
// }
//
// printf("\n");
// }
// 3.
// int count = 1;
// double numbers;
// double sumz,sumf;
// for (; count <= 10; count++) {
// printf("请输入第%d个数字:\n",count);
// scanf("%lf",&numbers);
// if (numbers > 0) {
// sumz += numbers;
// }
// if (numbers < 0) {
// sumf += numbers;
// }
//
// }
// printf("正数之和为:%g\n负数之和为%g\n",sumz,sumf);
// 4.
//
// int i;
// int rate = 23;
// double money = 8888.0;
// printf("年\t折旧率\t折旧前价格\t折旧后价格\t\n");
// printf("----------------------------------------\n");
// for (i = 0; i < 5; i++) {
// printf("%d\t%d%%\t%.2lf\t\t%.2lf\t\n",i+1,rate,money,money = money*(100-rate)/100);
// rate += 9;
// }
//
return 0;
}</span></strong>