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:变量的命名规范 只能由数字 字母 及下划线组成 不能以数字开头 不能与系统关键字重名 _开头有特殊含义 __开头__结尾的变量是魔法变量 支持大小驼峰 ,但建议使用下划线连接语 ...
随机推荐
- java dyn proxy
package dyn; public interface RealService { void buy(); } =================== package dyn; public cl ...
- PAT乙级 1017. A除以B (20)
1017. A除以B (20) 时间限制 100 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue 本题要求计算A/B,其中A是不超过 ...
- SQLServer查询速度慢的原因
查询速度慢的原因很多,常见如下几种: 1.没有索引或者没有用到索引(这是查询慢最常见的问题,是程序设计的缺陷) 2.I/O吞吐量小,形成了瓶颈效应. 3.没有创建计算列导致查询不优化. 4.内存 ...
- [置顶] 一个懦弱的IT人
对自己近来的学习和工作做一个总结,规划一下未来. 还是从大三暑假说起,稀里糊涂的被拉去参加电子设计大赛,熬过了一段痛苦的时间.原本我是学计算机的,对硬件不太熟悉.不过经过一段时间痛苦的断断续续的学习, ...
- android 应用架构随笔六(Loading加载页面)
import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import com.heima ...
- iOS delegate, 代理/委托与协议.
之前知知道iOS协议怎么写, 以为真的跟特么java接口一样, 后来发现完全不是. 首先, 说说应用场景, 就是当你要用一个程序类, 或者说逻辑类, 去控制一个storyboard里面的label, ...
- Backup: Array in Perl6
Array in Perl6 继承List,而List又继承Iterable,Positional,Cool ARRAY.pop ARRAY.shift ARRAY.push: VALUES ARRA ...
- 如何优化tomcat配置(从内存、并发、缓存4个方面)优化
Tomcat有很多方面,我从内存.并发.缓存四个方面介绍优化方法. ** 一.Tomcat内存优化 ** Tomcat内存优化主要是对 tomcat 启动参数优化,我们可以在 tomcat 的启动脚 ...
- postgres创建用户,表
使用createuser来创建用户 [postgres@web1 ~]$ /data/pgsql/bin/createuser --help createuser creates a new Post ...
- FLASH的知识【转】
转自:http://blog.csdn.net/xgbing/article/details/18422691 版权声明:原创文章,转载请注明来自:http://blog.csdn.net/xgbin ...