C语言第4天循环,流程控制。
C语言第四天
:first-child { margin-top: 0; } blockquote > :last-child { margin-bottom: 0; } img { border: 0; max-width: 100%; height: auto !important; margin: 2px 0; } table { border-collapse: collapse; border: 1px solid #bbbbbb; } td, th { padding: 4px 8px; border-collapse: collapse; border: 1px solid #bbbbbb; } @media only screen and (-webkit-max-device-width: 1024px), only screen and (-o-max-device-width: 1024px), only screen and (max-device-width: 1024px), only screen and (-webkit-min-device-pixel-ratio: 3), only screen and (-o-min-device-pixel-ratio: 3), only screen and (min-device-pixel-ratio: 3) { html, body { font-size: 17px; } body { line-height: 1.7; padding: 0.75rem 0.9375rem; color: #353c47; } h1 { font-size: 2.125rem; } h2 { font-size: 1.875rem; } h3 { font-size: 1.625rem; } h4 { font-size: 1.375rem; } h5 { font-size: 1.125rem; } h6 { color: inherit; } ul, ol { padding-left: 2.5rem; } blockquote { padding: 0 0.9375rem; } }
-->
div{font-size:15px;}.wiz-table-tools .wiz-table-menu-item.active .wiz-table-menu-sub {display: block}.wiz-table-tools .wiz-table-menu-sub:before, .wiz-table-tools .wiz-table-menu-sub:after {position: absolute;content: " ";border-style: solid;border-color: transparent;border-bottom-color: #cccccc;left: 22px;margin-left: -14px;top: -8px;border-width: 0 8px 8px 8px;z-index:10;}.wiz-table-tools .wiz-table-menu-sub:after {border-bottom-color: #ffffff;top: -7px;}.wiz-table-tools .wiz-table-menu-sub-item {padding: 4px 12px;font-size: 14px;}.wiz-table-tools .wiz-table-menu-sub-item.split {border-top: 1px solid #E0E0E0;}.wiz-table-tools .wiz-table-menu-sub-item:hover {background-color: #ececec;}.wiz-table-tools .wiz-table-menu-sub-item.disabled {color: #bbbbbb;cursor: default;}.wiz-table-tools .wiz-table-menu-sub-item.disabled:hover {background-color: transparent;}.wiz-table-tools .wiz-table-menu-item.wiz-table-cell-bg:hover .wiz-table-color-pad {display: block;}.wiz-table-tools .wiz-table-color-pad {display: none;padding: 10px;box-sizing: border-box;width: 85px;height: 88px;background-color: #fff;cursor: default;}.wiz-table-tools .wiz-table-color-pad > div{font-size:15px;}.wiz-table-tools .wiz-table-color-pad .wiz-table-color-pad-item {display: inline-block;width: 15px;height: 15px;margin-right: 9px;position: relative;}.wiz-table-tools .wiz-table-color-pad .wiz-table-color-pad-item i.pad-demo {position: absolute;top:3px;left:0;}.wiz-table-tools .wiz-table-color-pad .wiz-table-color-pad-item .icon-oblique_line{color: #cc0000;}.wiz-table-tools .wiz-table-color-pad .wiz-table-color-pad-item:last-child {margin-right: 0;}.wiz-table-tools .wiz-table-color-pad .wiz-table-color-pad-item.active i.editor-icon.icon-box {color: #448aff;}.wiz-table-tools .wiz-table-cell-align {display: none;padding: 10px;box-sizing: border-box;width: 85px;height: 65px;background-color: #fff;cursor: default;}.wiz-table-tools .wiz-table-cell-align .wiz-table-cell-align-item {display: inline-block;width: 15px;height: 15px;margin-right: 9px;position: relative;}.wiz-table-tools .wiz-table-cell-align .wiz-table-cell-align-item:last-child {margin-right:0}.wiz-table-tools .wiz-table-cell-align .wiz-table-cell-align-item i.valign{position: absolute;top:3px;left:0;color: #d2d2d2;}.wiz-table-tools .wiz-table-cell-align-item.active i.editor-icon.valign {color: #a1c4ff;}.wiz-table-tools .wiz-table-cell-align-item.active i.editor-icon.icon-box,.wiz-table-tools .wiz-table-cell-align-item.active i.editor-icon.align {color: #448aff;}.wiz-table-tools .wiz-table-color-pad .wiz-table-color-pad-item:last-child,.wiz-table-tools .wiz-table-cell-align .wiz-table-cell-align-item:last-child {margin-right: 0;}th.wiz-selected-cell, td.wiz-selected-cell {background: rgba(0,102,255,.05);}th:before,td:before,#wiz-table-col-line:before,#wiz-table-range-border_start_right:before,#wiz-table-range-border_range_right:before{content: " ";position: absolute;top: 0;bottom: 0;right: -5px;width: 9px;cursor: col-resize;background: transparent;z-index:100;}th:after,td:after,#wiz-table-row-line:before,#wiz-table-range-border_start_bottom:before,#wiz-table-range-border_range_bottom:before{content: " ";position: absolute;left: 0;right: 0;bottom: -5px;height: 9px;cursor: row-resize;background: transparent;z-index:100;}.wiz-table-container {}.wiz-table-body {position:relative;padding:0 0 10px;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;}.wiz-table-body table {margin:0;outline:none;}td,th {height:28px;word-break:break-all;box-sizing:border-box;outline:none;}
-->
大小写转换代码<wiz_tmp_tag id="wiz-table-range-border" contenteditable="false" style="display: none;">
# include <stdio.h>int main(int argc,constchar*argv[]){#if 0int a =10;if(a>0)printf("a>0");elseif(a==0)printf("a=0");elseprintf("a<0");putchar(10);return0;#endifputs("please input word");int a =0;a= getchar();if('A'<=a&&a<='Z'){putchar(a+32);}elseif( a>='a'&&a<='z'){putchar (a-32);}elseputs("error");}
#include<stdio.h>int main(int argc,constchar*argv[]){int i =0, count_ji =0, count_ou =0, num_ji =0, num_ou =0;while(1){if(scanf("%d",&i)!=1){puts("error");return-1;}if(i ==0){puts("end");break;}if(i %2){count_ji++;num_ji += i;}else{count_ou++;num_ou += i;}}if(count_ji !=0){num_ji /= count_ji;}if(count_ou !=0){num_ou /= count_ou;}printf("count_ji = %d, count_ou = %d\n",count_ji, count_ou);printf("平均值_ji = %d, 平均值_ou = %d\n",num_ji, num_ou);return0;}
int a =3;int i=0,j=0;float sum_ji=0;float sum_ou=0;while(1){if( scanf("%d",&a)!=1){return-1;}elseif(a==0){puts("end");break;}if(a%2==0){i++;sum_ou+=a;}else{j++;sum_ji+=a;}}printf("%d %d\n",i,j);if(i!=0){printf("%f\n",sum_ou);}if(j!=0){printf("%f\n",sum_ji);}#endifint a;int xiaoshi=0,fen=0;while(1){if(scanf("%d",&a)!=1){printf("try again!");getchar();continue;}else{xiaoshi=a/60;fen= a%60;printf("%02d:%02d\n",xiaoshi,fen);}}return0;}
# include <stdio.h>int main(int argc,constchar*argv[]){/* int i=0;int sum =0;for( i=0;i<=10;i++){sum+=i;}printf("%d\n",sum);*/int a,b,i,j;for(i=1;i<=9;i++){for(j=1;j<=i;j++){printf("%-2d*%-2d=%-2d ",j,i,i*j);}putchar(10);}return0;}
int i ;int bai,shi,ge;for(i=100;i<=999;i++){ge = i%10;shi=i/10%10;bai=i/100;// printf("%d\n%d\n%d\n",ge,shi,bai);if(i==ge*ge*ge+shi*shi*shi+bai*bai*bai)printf("%d\n",i);}

int i,j,h;for(i=1;i<7;i++){for(j=i;j>=1;j--){printf("_");}for(h=0;h<i;h++){printf("%c",'F'-h);}putchar(10);}return0;}
int i ,j;for(i=2;i<100;i++){for(j=2;j<=i;j++){if(( i%j==0)&&(i!=j))break;if(i==j)printf("%d\n",i);}}
# include <stdio.h>int main(int argc,constchar*argv[]){int nian,yue,ri;int flag =1;int sum=0;while(1){puts("please input:");if(scanf("%d %d %d",&nian,&yue,&ri)!=3){puts("input error,try again:");getchar();getchar();getchar();continue;}if((nian<0||nian>=9999)||0>yue||yue>12){puts("输入错误!请重新输入");continue;}//判断输入到数字是否合理if(yue==1||yue==3||yue==5||yue==7||yue==8||yue==10||yue==12){if(0>ri||ri>31){puts("日输入错误!请重新输入");continue;}}if(yue==4||yue==6||yue==9||yue==11){if(ri>30){puts("日输入错误!请重新输入");continue;}}{if((nian%4==0)&&(nian%100!=0)||nian%400==0){flag=1;if(yue==2)if(ri<0||ri>29){puts("日输入错误!请重新输入");continue;}}else{if(yue==2)if(ri<0||ri>28){puts("日输入错误!请重新输入");continue;}flag=0;}}switch(yue-1){case11:sum+=30;case10:sum+=31;case9:sum+=30;case8:sum+=31;case7:sum+=31;case6:sum+=30;case5:sum+=31;case4:sum+=30;case3:sum+=31;case2:{if(flag)sum+=29;else sum+=28;}case1:sum+=31;}printf("%d\n",sum+ri);sum=0;}return0;}
C语言第4天循环,流程控制。的更多相关文章
- GO语言的进阶之路-流程控制
GO语言的进阶之路-流程控制 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 流程控制在编程语言中是最伟大的发明了,因为有了它,你可以通过很简单的流程描述来表达很复杂的逻辑.流程控制 ...
- 循环流程控制&方法(3)
1.循环流程控制 当某一段代码需要重复执行多次的时候,就需要用到循环: 循环三要素: 循环的起点:循环的终点(结束条件):步长: 当循环条件不再成立,结束循环: for循环 for(循环起点:循环条件 ...
- day05流程控制while循环 流程控制for循环
1.什么是循环:循环就是重复做某事 2.为何要有循环:为了计算机能够具备人重复做某事的能力 3,.如何用循环: 1.结束while循环的两种方法:1.修改条件:等到下一次循环开始时判断,条件为假才会结 ...
- 【原创】go语言学习(四)流程控制
目录: 1.if else语句块 2.for语句 3.switch语句 if else语句块 1.基本语法 if condition { //do something } if statement; ...
- Go语言基础之流程控制
Go语言基础之流程控制 流程控制是每种编程语言控制逻辑走向和执行次序的重要部分,流程控制可以说是一门语言的“经脉”. Go语言中最常用额流程控制有if和for,而switch和goto主要是为了简化代 ...
- Go语言( 流程控制)
流程控制是每种编程语言控制逻辑走向和执行次序的重要部分,流程控制可以说是一门语言的“经脉”. Go语言中最常用的流程控制有if和for,而switch和goto主要是为了简化代码.降低重复代码而生的结 ...
- Go语言 - 流程控制 if else | for | switch case
流程控制 流程控制是每种编程语言控制逻辑走向和执行次序的重要部分,流程控制可以说是一门语言的“经脉”. Go语言中最常用的流程控制: if | for | switch | goto// switch ...
- 1.4 Go语言基础之流程控制
流程控制是每种编程语言控制逻辑走向和执行次序的重要部分,流程控制可以说是一门语言的"经脉". Go语言中最常用的流程控制有if和for,而switch和goto主要是为了简化代码. ...
- GO学习-(7) Go语言基础之流程控制
流程控制是每种编程语言控制逻辑走向和执行次序的重要部分,流程控制可以说是一门语言的"经脉". Go语言中最常用的流程控制有if和for,而switch和goto主要是为了简化代码. ...
- day_4流程控制之分支结构循环结构及for循环
复习一下昨天的内容 1:变量的命名规范 只能由数字 字母 及下划线组成 不能以数字开头 不能与系统关键字重名 _开头有特殊含义 __开头__结尾的变量是魔法变量 支持大小驼峰 ,但建议使用下划线连接语 ...
随机推荐
- CCF真题之ISBN号码
201312-2 问题描述 每一本正式出版的图书都有一个ISBN号码与之对应,ISBN码包括9位数字.1位识别码和3位分隔符,其规定格式如“x-xxx-xxxxx-x”,其中符号“-”是分隔符(键盘上 ...
- Android 测试Service的生命周期
package com.example.myapp4; import android.support.v7.app.ActionBarActivity; import android.content. ...
- C#.Net GC(garbage Collector) 垃圾回收器
以前一直以为gc的原理很简单,也就是分代处理堆数据,直到我的膝盖中了一箭(好吧 直到有天汪涛和我说他面试携程的面试题 关于服务器和 工作站gc 的区别)其实我当时尚不知道 工作站和服务器有什么区别更不 ...
- 夺命雷公狗ThinkPHP项目之----企业网站30之网站前台头部导航的高亮显示
我们这个其实也是最简单的一个,首页高亮,那么我们需要先在中间层里面定义一个index = false: 然后在首页控制器里面定义一个 index = true 最后一步就是 在首页的模版上给一个判断: ...
- 夺命雷公狗-----tp中遇到数据乘积的问题的遇见
昨晚遇到了一个很神奇的问题, 然后打印出来的结果是 ) LIMIT , 然后dump出来的结果有点无语,他是10*10这样的倍增的,如果数据量大,分分钟直接可以让服务器直接死掉.... 想这问题我想了 ...
- 夺命雷公狗---DEDECMS----12dedecms全局标签的使用以及嵌套标签的使用
在网站开发中,在很多页面可能会使用到同一个变量,比如路径网站信息等,所以我们可以用全局变量来使用. 默认的放在: 进去里面看下就会发现很多的常量都是在这里定义的: 我们在实际开发的时候可以将我们在多个 ...
- DMA-330(二)
DMA内部的block diagram: DMAC包含一个instruction processing block,来process program code,control DMA transfer ...
- 常用的DC插头公头的尺寸
2.0*0.6mm:这种应该是用在诺基亚黑白屏那种手机上的充电插头 2.5*0.7mm:这种不知用在哪里 3.5*1.35mm:应该是以前那种小型的磁带机放音机上用的 4.0*1.7mm:已知 ora ...
- Chrome常用快捷键
F2F3 下一个标签 Ctrl+1-9 切换标签 Ctrl+W 关闭 Ctrl+D 保存书签 Ctrl+T 新建书签然后地址栏输入搜索 Ctrl+Shft+T 打开上次关闭 空格 下翻页 Ctrl+J ...
- 使用git和github托管个人项目
1. 安装 cygwin 和 cygwin 下的 git , 测试 git 命令可用; 参考: https://cygwin.com/install.html 2. 注册 github 账号: ...