程序说明
数字模式是根据称为模式规则的规则创建的数字序列。模式规则可以使用一个或多个数学运算来描述序列中连续数字之间的关系。
模式示例
模式 1
1 2 6 3 7 10 4 8 11 13 5 9 12 14 15
模式 2
奥硕企业网站管理系统具有一下特色功能1、双语双模(中英文采用单独模板设计,可制作中英文不同样式的网站)2、在线编辑JS动态菜单支持下拉效果,同时生成中文,英文,静态3个JS菜单3、在线制作并调用FLASH展示动画4、自动生成缩略图,可以自由设置宽高5、图片批量加水印,可以自由设置字体,大小,样式,水印位置(同时支持文字或图片类型水印)6、强大的标签式数据调用,可以调用(新闻,产品,下载,招聘)支持
1
1 2 3
1 2 3 4 5
1 2 3 4 5 6 7
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7
1 2 3 4 5
1 2 3
1算法
Pattern 1: i stands for rows and j stands for columns. 5 stands for making pattern for 5 Rows and Columns Loop for each Row (i) K is initialized to i Loop for each Column (j) Do the Pattern for the current Column (j) Display the Value of K Reinitialize the Value of K = k + 5 - j Pattern 2: First Row: Display 1 Second Row: Display 1,2,3 Third Row: Display 1,2,3,4,5 Fourth Row: Display 1,2,3,4,5,6,7 Fifth Row: Display 1,2,3,4,5,6,7,8,9 Display the same contents from 4th Row till First Row below the fifth Row.
示例
/* Program to print Numeric Pattern */ #includeint main(){ int i,j,k; printf("Numeric Pattern 1"); printf(" "); printf("
"); for(i=1;i<=5;i++){ k = i; for(j=1;j<=i;j++){ printf("%d ", k); k += 5-j; } printf("
"); } printf("
"); printf("Numeric Pattern 2"); printf("
"); printf("
"); for(i = 1;i<=5;i++){ for(j = i;j<5;j++){ printf(" "); } for(k = 1;k<(i*2);k++){ printf("%d",k); } printf("
"); } for(i = 4;i>=1;i--){ for(j = 5;j>i;j--){ printf(" "); } for(k = 1;k<(i*2);k++){ printf("%d",k); } printf("
"); } getch(); return 0; }
输出

立即学习“C语言免费学习笔记(深入)”;










