iBokan_ios80_自学系列_1(~循环结构~)

<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>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值